From bbc6c2986c3c1beede09335f4e2c3bad57fcb733 Mon Sep 17 00:00:00 2001 From: Hendrik Liebau Date: Fri, 10 Nov 2023 18:27:38 +0100 Subject: [PATCH] [Flight] Fix `reference` param type in `registerServerReference` The `reference` that is passed into `registerServerReference` can be a plain function. It does not need to have the three additonal properties of a `ServerRefeference`. In fact, adding these properties (plus `bind`) is precisely what `registerServerReference` does. --- packages/react-server-dom-esm/src/ReactFlightESMReferences.js | 4 ++-- .../src/ReactFlightTurbopackReferences.js | 4 ++-- .../src/ReactFlightWebpackReferences.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/react-server-dom-esm/src/ReactFlightESMReferences.js b/packages/react-server-dom-esm/src/ReactFlightESMReferences.js index 2b051e72f987d..9a3346c4bf280 100644 --- a/packages/react-server-dom-esm/src/ReactFlightESMReferences.js +++ b/packages/react-server-dom-esm/src/ReactFlightESMReferences.js @@ -63,8 +63,8 @@ function bind(this: ServerReference): any { return newFn; } -export function registerServerReference( - reference: ServerReference, +export function registerServerReference( + reference: T, id: string, exportName: string, ): ServerReference { diff --git a/packages/react-server-dom-turbopack/src/ReactFlightTurbopackReferences.js b/packages/react-server-dom-turbopack/src/ReactFlightTurbopackReferences.js index 39b178ed9f561..89985348b2c78 100644 --- a/packages/react-server-dom-turbopack/src/ReactFlightTurbopackReferences.js +++ b/packages/react-server-dom-turbopack/src/ReactFlightTurbopackReferences.js @@ -76,8 +76,8 @@ function bind(this: ServerReference): any { return newFn; } -export function registerServerReference( - reference: ServerReference, +export function registerServerReference( + reference: T, id: string, exportName: null | string, ): ServerReference { diff --git a/packages/react-server-dom-webpack/src/ReactFlightWebpackReferences.js b/packages/react-server-dom-webpack/src/ReactFlightWebpackReferences.js index 059925a3cfa1a..b174953a72c4f 100644 --- a/packages/react-server-dom-webpack/src/ReactFlightWebpackReferences.js +++ b/packages/react-server-dom-webpack/src/ReactFlightWebpackReferences.js @@ -76,8 +76,8 @@ function bind(this: ServerReference): any { return newFn; } -export function registerServerReference( - reference: ServerReference, +export function registerServerReference( + reference: T, id: string, exportName: null | string, ): ServerReference {