diff --git a/packages/react-client/src/ReactFlightClient.js b/packages/react-client/src/ReactFlightClient.js index 1fb6ca6c2b0d1..574893125d535 100644 --- a/packages/react-client/src/ReactFlightClient.js +++ b/packages/react-client/src/ReactFlightClient.js @@ -65,6 +65,7 @@ import { REACT_LAZY_TYPE, REACT_ELEMENT_TYPE, REACT_POSTPONE_TYPE, + ASYNC_ITERATOR, } from 'shared/ReactSymbols'; export type {CallServerCallback, EncodeFormActionCallback}; @@ -1245,8 +1246,6 @@ function startReadableStream( resolveStream(response, id, stream, flightController); } -const ASYNC_ITERATOR = Symbol.asyncIterator; - function asyncIterator(this: $AsyncIterator) { // Self referencing iterator. return this; diff --git a/packages/react-server/src/ReactFlightServer.js b/packages/react-server/src/ReactFlightServer.js index 254e26e675bd0..93924692d28f5 100644 --- a/packages/react-server/src/ReactFlightServer.js +++ b/packages/react-server/src/ReactFlightServer.js @@ -99,6 +99,7 @@ import { REACT_LAZY_TYPE, REACT_MEMO_TYPE, REACT_POSTPONE_TYPE, + ASYNC_ITERATOR, } from 'shared/ReactSymbols'; import { @@ -201,8 +202,6 @@ if ( const ObjectPrototype = Object.prototype; -const ASYNC_ITERATOR = Symbol.asyncIterator; - type JSONValue = | string | boolean diff --git a/packages/shared/ReactSymbols.js b/packages/shared/ReactSymbols.js index 32f3ef654068d..26662aa325e7c 100644 --- a/packages/shared/ReactSymbols.js +++ b/packages/shared/ReactSymbols.js @@ -60,3 +60,5 @@ export function getIteratorFn(maybeIterable: ?any): ?() => ?Iterator { } return null; } + +export const ASYNC_ITERATOR = Symbol.asyncIterator;