Skip to content

Commit

Permalink
[Flight] Fix reference param type in registerServerReference
Browse files Browse the repository at this point in the history
The `reference` that is passed into `registerServerReference` can be a plain function. It must not have the three additonal properties of a `ServerRefeference`. In fact, adding these properties (plus `bind`) is precisely what `registerServerReference` does.
  • Loading branch information
unstubbable committed Nov 10, 2023
1 parent 6b3834a commit 28f709e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/react-server-dom-esm/src/ReactFlightESMReferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ function bind(this: ServerReference<any>) {
return newFn;
}

export function registerServerReference<T>(
reference: ServerReference<T>,
export function registerServerReference<T: Function>(
reference: T,
id: string,
exportName: string,
): ServerReference<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ function bind(this: ServerReference<any>) {
return newFn;
}

export function registerServerReference<T>(
reference: ServerReference<T>,
export function registerServerReference<T: Function>(
reference: T,
id: string,
exportName: null | string,
): ServerReference<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ function bind(this: ServerReference<any>) {
return newFn;
}

export function registerServerReference<T>(
reference: ServerReference<T>,
export function registerServerReference<T: Function>(
reference: T,
id: string,
exportName: null | string,
): ServerReference<T> {
Expand Down

0 comments on commit 28f709e

Please sign in to comment.