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 does not need to 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 24, 2023
1 parent 6c7b41d commit bbc6c29
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 @@ -63,8 +63,8 @@ function bind(this: ServerReference<any>): 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 @@ -76,8 +76,8 @@ function bind(this: ServerReference<any>): 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 @@ -76,8 +76,8 @@ function bind(this: ServerReference<any>): 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 bbc6c29

Please sign in to comment.