@samitouri / QOS-React-2 / commits / a473d08fce

Update to Flow from 0.97 to 0.122 (#25204)

* flow 0.122 * update ReactModel type

Jan Kassens committed Sep 8, 2022 at 11:46 UTC a473d08fcee187f957b844b53b2eee2d2714630b
43 files changed +109 -51
package.json
+1 -1
@@ -63,7 +63,7 @@
63 "eslint-plugin-react-internal": "link:./scripts/eslint-rules",
64 "fbjs-scripts": "1.2.0",
65 "filesize": "^6.0.1",
66 - "flow-bin": "0.97",
66 + "flow-bin": "^0.122",
67 "glob": "^7.1.6",
68 "glob-stream": "^6.1.0",
69 "google-closure-compiler": "^20200517.0.0",
packages/jest-react/src/internalAct.js
+2
@@ -28,6 +28,8 @@ export function act<T>(scope: () => Thenable<T> | T): Thenable<T> {
28 'This version of `act` requires a special mock build of Scheduler.',
29 );
30 }
31 +
32 + // $FlowFixMe: _isMockFunction doesn't exist on function
33 if (setTimeout._isMockFunction !== true) {
34 throw Error(
35 "This version of `act` requires Jest's timer mocks " +
packages/react-debug-tools/src/ReactDebugHooks.js
+1
@@ -683,6 +683,7 @@ function handleRenderFunctionError(error: any): void {
683 // TODO: refactor this if we ever combine the devtools and debug tools packages
684 wrapperError.name = 'ReactDebugToolsRenderError';
685 // this stage-4 proposal is not supported by all environments yet.
686 + // $FlowFixMe Flow doesn't have this type yet.
687 wrapperError.cause = error;
688 throw wrapperError;
689 }
packages/react-devtools-shared/src/backend/StyleX/utils.js
+2
@@ -92,7 +92,9 @@ function getPropertyValueForStyleName(styleName: string): string | null {
92 ]: any): CSSStyleSheet);
93 // $FlowFixMe Flow doesn't konw about these properties
94 const rules = styleSheet.rules || styleSheet.cssRules;
95 + // $FlowFixMe `rules` is mixed
96 for (let ruleIndex = 0; ruleIndex < rules.length; ruleIndex++) {
97 + // $FlowFixMe `rules` is mixed
98 const rule = rules[ruleIndex];
99 // $FlowFixMe Flow doesn't konw about these properties
100 const {cssText, selectorText, style} = rule;
packages/react-devtools-shared/src/backend/renderer.js
+4 -3
@@ -124,7 +124,7 @@ import type {
124 } from 'react-devtools-shared/src/types';
125
126 type getDisplayNameForFiberType = (fiber: Fiber) => string | null;
127 -type getTypeSymbolType = (type: any) => Symbol | number;
127 +type getTypeSymbolType = (type: any) => symbol | number;
128
129 type ReactPriorityLevelsType = {|
130 ImmediatePriority: number,
@@ -382,13 +382,14 @@ export function getInternalReactConstants(
382 // End of copied code.
383 // **********************************************************
384
385 - function getTypeSymbol(type: any): Symbol | number {
385 + function getTypeSymbol(type: any): symbol | number {
386 const symbolOrNumber =
387 typeof type === 'object' && type !== null ? type.$$typeof : type;
388
389 // $FlowFixMe Flow doesn't know about typeof "symbol"
390 return typeof symbolOrNumber === 'symbol'
391 - ? symbolOrNumber.toString()
391 + ? // $FlowFixMe `toString()` doesn't match the type signature?
392 + symbolOrNumber.toString()
393 : symbolOrNumber;
394 }
395
packages/react-devtools-shared/src/backend/types.js
+1 -1
@@ -84,7 +84,7 @@ export type GetFiberIDForNative = (
84 export type FindNativeNodesForFiberID = (id: number) => ?Array<NativeType>;
85
86 export type ReactProviderType<T> = {
87 - $$typeof: Symbol | number,
87 + $$typeof: symbol | number,
88 _context: ReactContext<T>,
89 ...
90 };
packages/react-devtools-shared/src/devtools/views/Button.js
+1
@@ -28,6 +28,7 @@ export default function Button({
28 ...rest
29 }: Props) {
30 let button = (
31 + // $FlowFixMe unsafe spread
32 <button
33 className={`${styles.Button} ${className}`}
34 data-testname={testName}
packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.js
+1
@@ -42,6 +42,7 @@ export default function AutoSizeInput({
42 const isEmpty = value === '' || value === '""';
43
44 return (
45 + // $FlowFixMe unsafe rest spread
46 <input
47 className={[styles.Input, className].join(' ')}
48 data-testname={testName}
packages/react-devtools-shared/src/devtools/views/Components/reach-ui/menu-button.js
+1
@@ -19,6 +19,7 @@ import useThemeStyles from '../../useThemeStyles';
19 const MenuList = ({children, ...props}: {children: React$Node, ...}) => {
20 const style = useThemeStyles();
21 return (
22 + // $FlowFixMe unsafe spread
23 <ReachMenuList style={style} {...props}>
24 {children}
25 </ReachMenuList>
packages/react-devtools-shared/src/devtools/views/Components/reach-ui/tooltip.js
+1
@@ -23,6 +23,7 @@ const Tooltip = ({
23 }) => {
24 const style = useThemeStyles();
25 return (
26 + // $FlowFixMe unsafe spread
27 <ReachTooltip
28 className={`${tooltipStyles.Tooltip} ${className}`}
29 style={style}
packages/react-devtools-shared/src/hydration.js
+1 -1
@@ -396,7 +396,7 @@ export function hydrate(
396 parent[last] = undefined;
397 } else {
398 // Replace the string keys with Symbols so they're non-enumerable.
399 - const replaced: {[key: Symbol]: boolean | string, ...} = {};
399 + const replaced: {[key: symbol]: boolean | string, ...} = {};
400 replaced[meta.inspectable] = !!value.inspectable;
401 replaced[meta.inspected] = false;
402 replaced[meta.name] = value.name;
packages/react-devtools-shared/src/node_modules/react-window/src/createGridComponent.js
+1
@@ -613,6 +613,7 @@ export default function createGridComponent({
613 } else {
614 itemStyleCache[key] = style = {
615 position: 'absolute',
616 + // $FlowFixMe computed properties are unsupported
617 [direction === 'rtl' ? 'right' : 'left']: getColumnOffset(
618 this.props,
619 columnIndex,
packages/react-devtools-shared/src/node_modules/react-window/src/createListComponent.js
+1
@@ -469,6 +469,7 @@ export default function createListComponent({
469
470 itemStyleCache[index] = style = {
471 position: 'absolute',
472 + // $FlowFixMe computed properties are unsupported
473 [direction === 'rtl' ? 'right' : 'left']: isHorizontal ? offset : 0,
474 top: !isHorizontal ? offset : 0,
475 height: !isHorizontal ? size : '100%',
packages/react-devtools-shared/src/registerDevToolsEventLogger.js
+3 -1
@@ -31,6 +31,7 @@ export function registerDevToolsEventLogger(
31 let metadata = null;
32 if (event.metadata != null) {
33 metadata = event.metadata;
34 + // $FlowFixMe: metadata is not writable and nullable
35 delete event.metadata;
36 }
37 loggingIFrame.contentWindow.postMessage(
@@ -42,7 +43,8 @@ export function registerDevToolsEventLogger(
43 version: process.env.DEVTOOLS_VERSION,
44 metadata: metadata !== null ? JSON.stringify(metadata) : '',
45 ...(fetchAdditionalContext != null
45 - ? await fetchAdditionalContext()
46 + ? // $FlowFixMe
47 + await fetchAdditionalContext()
48 : {}),
49 },
50 },
packages/react-devtools-shared/src/utils.js
+3 -3
@@ -67,8 +67,8 @@ const encodedStringCache: LRUCache<string, Array<number>> = new LRU({
67 });
68
69 export function alphaSortKeys(
70 - a: string | number | Symbol,
71 - b: string | number | Symbol,
70 + a: string | number | symbol,
71 + b: string | number | symbol,
72 ): number {
73 if (a.toString() > b.toString()) {
74 return 1;
@@ -81,7 +81,7 @@ export function alphaSortKeys(
81
82 export function getAllEnumerableKeys(
83 obj: Object,
84 -): Set<string | number | Symbol> {
84 +): Set<string | number | symbol> {
85 const keys = new Set();
86 let current = obj;
87 while (current != null) {
packages/react-dom/src/events/SyntheticEvent.js
+24 -7
@@ -166,7 +166,9 @@ let lastMouseEvent;
166 function updateMouseMovementPolyfillState(event) {
167 if (event !== lastMouseEvent) {
168 if (lastMouseEvent && event.type === 'mousemove') {
169 + // $FlowFixMe assuming this is a number
170 lastMovementX = event.screenX - lastMouseEvent.screenX;
171 + // $FlowFixMe assuming this is a number
172 lastMovementY = event.screenY - lastMouseEvent.screenY;
173 } else {
174 lastMovementX = 0;
@@ -367,7 +369,9 @@ function getEventKey(nativeEvent) {
369
370 // FireFox implements `key` but returns `MozPrintableKey` for all
371 // printable characters (normalized to `Unidentified`), ignore it.
370 - const key = normalizeKey[nativeEvent.key] || nativeEvent.key;
372 + const key =
373 + // $FlowFixMe unable to index with a `mixed` value
374 + normalizeKey[nativeEvent.key] || nativeEvent.key;
375 if (key !== 'Unidentified') {
376 return key;
377 }
@@ -375,7 +379,10 @@ function getEventKey(nativeEvent) {
379
380 // Browser does not implement `key`, polyfill as much of it as we can.
381 if (nativeEvent.type === 'keypress') {
378 - const charCode = getEventCharCode(nativeEvent);
382 + const charCode = getEventCharCode(
383 + // $FlowFixMe unable to narrow to `KeyboardEvent`
384 + nativeEvent,
385 + );
386
387 // The enter-key is technically both printable and non-printable and can
388 // thus be captured by `keypress`, no other non-printable key should.
@@ -384,6 +391,7 @@ function getEventKey(nativeEvent) {
391 if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
392 // While user keyboard layout determines the actual meaning of each
393 // `keyCode` value, almost all function keys have a universal value.
394 + // $FlowFixMe unable to index with a `mixed` value
395 return translateToKey[nativeEvent.keyCode] || 'Unidentified';
396 }
397 return '';
@@ -441,7 +449,10 @@ const KeyboardEventInterface = {
449 // KeyPress is deprecated, but its replacement is not yet final and not
450 // implemented in any major browser. Only KeyPress has charCode.
451 if (event.type === 'keypress') {
444 - return getEventCharCode(event);
452 + return getEventCharCode(
453 + // $FlowFixMe unable to narrow to `KeyboardEvent`
454 + event,
455 + );
456 }
457 return 0;
458 },
@@ -462,7 +473,10 @@ const KeyboardEventInterface = {
473 // `which` is an alias for either `keyCode` or `charCode` depending on the
474 // type of the event.
475 if (event.type === 'keypress') {
465 - return getEventCharCode(event);
476 + return getEventCharCode(
477 + // $FlowFixMe unable to narrow to `KeyboardEvent`
478 + event,
479 + );
480 }
481 if (event.type === 'keydown' || event.type === 'keyup') {
482 return event.keyCode;
@@ -538,7 +552,8 @@ const WheelEventInterface = {
552 ? event.deltaX
553 : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
554 'wheelDeltaX' in event
541 - ? -event.wheelDeltaX
555 + ? // $FlowFixMe assuming this is a number
556 + -event.wheelDeltaX
557 : 0;
558 },
559 deltaY(event) {
@@ -546,10 +561,12 @@ const WheelEventInterface = {
561 ? event.deltaY
562 : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
563 'wheelDeltaY' in event
549 - ? -event.wheelDeltaY
564 + ? // $FlowFixMe assuming this is a number
565 + -event.wheelDeltaY
566 : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
567 'wheelDelta' in event
552 - ? -event.wheelDelta
568 + ? // $FlowFixMe assuming this is a number
569 + -event.wheelDelta
570 : 0;
571 },
572 deltaZ: 0,
packages/react-dom/src/server/ReactDOMFizzServerBrowser.js
+2 -2
@@ -57,10 +57,10 @@ function renderToReadableStream(
57 const stream: ReactDOMServerReadableStream = (new ReadableStream(
58 {
59 type: 'bytes',
60 - pull(controller) {
60 + pull(controller): ?Promise<void> {
61 startFlowing(request, controller);
62 },
63 - cancel(reason) {
63 + cancel(reason): ?Promise<void> {
64 abort(request);
65 },
66 },
packages/react-dom/src/server/ReactDOMFizzStaticBrowser.js
+1 -1
@@ -50,7 +50,7 @@ function prerender(
50 const stream = new ReadableStream(
51 {
52 type: 'bytes',
53 - pull(controller) {
53 + pull(controller): ?Promise<void> {
54 startFlowing(request, controller);
55 },
56 },
packages/react-fetch/src/ReactFetchNode.js
+1
@@ -43,6 +43,7 @@ function nodeFetch(
43 // TODO: cherry-pick supported user-passed options.
44 };
45 const nodeImpl = protocol === 'https:' ? https : http;
46 + // $FlowFixMe: node flow type has `port` as a number
47 const request = nodeImpl.request(nodeOptions, response => {
48 // TODO: support redirects.
49 onResolve(new Response(response));
packages/react-native-renderer/src/legacy-events/accumulateInto.js
+2
@@ -40,9 +40,11 @@ function accumulateInto<T>(
40 // certain that x is an Array (x could be a string with concat method).
41 if (isArray(current)) {
42 if (isArray(next)) {
43 + // $FlowFixMe `isArray` does not ensure array is mutable
44 current.push.apply(current, next);
45 return current;
46 }
47 + // $FlowFixMe `isArray` does not ensure array is mutable
48 current.push(next);
49 return current;
50 }
packages/react-noop-renderer/src/ReactNoopFlightServer.js
+1 -1
@@ -53,7 +53,7 @@ const ReactNoopFlightServer = ReactFlightServer({
53 },
54 resolveModuleMetaData(
55 config: void,
56 - reference: {$$typeof: Symbol, value: any},
56 + reference: {$$typeof: symbol, value: any},
57 ) {
58 return saveModule(reference.value);
59 },
packages/react-reconciler/src/ReactChildFiber.new.js
+1
@@ -80,6 +80,7 @@ if (__DEV__) {
80 );
81 }
82
83 + // $FlowFixMe unable to narrow type from mixed to writable object
84 child._store.validated = true;
85
86 const componentName = getComponentNameFromFiber(returnFiber) || 'Component';
packages/react-reconciler/src/ReactChildFiber.old.js
+1
@@ -80,6 +80,7 @@ if (__DEV__) {
80 );
81 }
82
83 + // $FlowFixMe unable to narrow type from mixed to writable object
84 child._store.validated = true;
85
86 const componentName = getComponentNameFromFiber(returnFiber) || 'Component';
packages/react-reconciler/src/ReactFiberCommitWork.new.js
+3
@@ -296,6 +296,7 @@ function safelyDetachRef(current: Fiber, nearestMountedAncestor: Fiber | null) {
296 }
297 }
298 } else {
299 + // $FlowFixMe unable to narrow type to RefObject
300 ref.current = null;
301 }
302 }
@@ -1522,6 +1523,7 @@ function commitAttachRef(finishedWork: Fiber) {
1523 }
1524 }
1525
1526 + // $FlowFixMe unable to narrow type to the non-function case
1527 ref.current = instanceToUse;
1528 }
1529 }
@@ -1542,6 +1544,7 @@ function commitDetachRef(current: Fiber) {
1544 currentRef(null);
1545 }
1546 } else {
1547 + // $FlowFixMe unable to narrow type to the non-function case
1548 currentRef.current = null;
1549 }
1550 }
packages/react-reconciler/src/ReactFiberCommitWork.old.js
+3
@@ -296,6 +296,7 @@ function safelyDetachRef(current: Fiber, nearestMountedAncestor: Fiber | null) {
296 }
297 }
298 } else {
299 + // $FlowFixMe unable to narrow type to RefObject
300 ref.current = null;
301 }
302 }
@@ -1522,6 +1523,7 @@ function commitAttachRef(finishedWork: Fiber) {
1523 }
1524 }
1525
1526 + // $FlowFixMe unable to narrow type to the non-function case
1527 ref.current = instanceToUse;
1528 }
1529 }
@@ -1542,6 +1544,7 @@ function commitDetachRef(current: Fiber) {
1544 currentRef(null);
1545 }
1546 } else {
1547 + // $FlowFixMe unable to narrow type to the non-function case
1548 currentRef.current = null;
1549 }
1550 }
packages/react-reconciler/src/ReactFiberHotReloading.new.js
+1
@@ -222,6 +222,7 @@ export function markFailedErrorBoundaryForHotReloading(fiber: Fiber) {
222 return;
223 }
224 if (failedBoundaries === null) {
225 + // $FlowFixMe Flow got confused by the feature check above.
226 failedBoundaries = new WeakSet();
227 }
228 failedBoundaries.add(fiber);
packages/react-reconciler/src/ReactFiberHotReloading.old.js
+1
@@ -222,6 +222,7 @@ export function markFailedErrorBoundaryForHotReloading(fiber: Fiber) {
222 return;
223 }
224 if (failedBoundaries === null) {
225 + // $FlowFixMe Flow got confused by the feature check above.
226 failedBoundaries = new WeakSet();
227 }
228 failedBoundaries.add(fiber);
packages/react-reconciler/src/ReactTestSelectors.js
+1 -1
@@ -39,7 +39,7 @@ if (typeof Symbol === 'function' && Symbol.for) {
39 TEXT_TYPE = symbolFor('selector.text');
40 }
41
42 -type Type = Symbol | number;
42 +type Type = symbol | number;
43
44 type ComponentSelector = {|
45 $$typeof: Type,
packages/react-server-dom-webpack/src/ReactFlightDOMServerBrowser.js
+3 -3
@@ -52,13 +52,13 @@ function renderToReadableStream(
52 const stream = new ReadableStream(
53 {
54 type: 'bytes',
55 - start(controller) {
55 + start(controller): ?Promise<void> {
56 startWork(request);
57 },
58 - pull(controller) {
58 + pull(controller): ?Promise<void> {
59 startFlowing(request, controller);
60 },
61 - cancel(reason) {},
61 + cancel(reason): ?Promise<void> {},
62 },
63 // $FlowFixMe size() methods are not allowed on byte streams.
64 {highWaterMark: 0},
packages/react-server-dom-webpack/src/ReactFlightServerWebpackBundlerConfig.js
+1 -1
@@ -17,7 +17,7 @@ export type BundlerConfig = WebpackMap;
17
18 // eslint-disable-next-line no-unused-vars
19 export type ModuleReference<T> = {
20 - $$typeof: Symbol,
20 + $$typeof: symbol,
21 filepath: string,
22 name: string,
23 async: boolean,
packages/react-server-dom-webpack/src/ReactFlightWebpackPlugin.js
+1 -1
@@ -25,7 +25,7 @@ import {
25 import isArray from 'shared/isArray';
26
27 class ClientReferenceDependency extends ModuleDependency {
28 - constructor(request) {
28 + constructor(request: mixed) {
29 super(request);
30 }
31
packages/react-server/src/ReactFlightServer.js
+9 -3
@@ -86,6 +86,7 @@ export type ReactModel =
86 | string
87 | boolean
88 | number
89 + | symbol
90 | null
91 | Iterable<ReactModel>
92 | ReactModelObject;
@@ -119,7 +120,7 @@ export type Request = {
120 completedModuleChunks: Array<Chunk>,
121 completedJSONChunks: Array<Chunk>,
122 completedErrorChunks: Array<Chunk>,
122 - writtenSymbols: Map<Symbol, number>,
123 + writtenSymbols: Map<symbol, number>,
124 writtenModules: Map<ModuleKey, number>,
125 writtenProviders: Map<string, number>,
126 identifierPrefix: string,
@@ -746,12 +747,17 @@ export function resolveModelToJSON(
747 if (existingId !== undefined) {
748 return serializeByValueID(existingId);
749 }
749 - const name = value.description;
750 + // $FlowFixMe `description` might be undefined
751 + const name: string = value.description;
752
753 + // $FlowFixMe `name` might be undefined
754 if (Symbol.for(name) !== value) {
755 throw new Error(
756 'Only global symbols received from Symbol.for(...) can be passed to client components. ' +
754 - `The symbol Symbol.for(${value.description}) cannot be found among global symbols. ` +
757 + `The symbol Symbol.for(${
758 + // $FlowFixMe `description` might be undefined
759 + value.description
760 + }) cannot be found among global symbols. ` +
761 `Remove ${describeKeyForErrorMessage(
762 key,
763 )} from this object, or avoid the entire object: ${describeObjectForErrorMessage(
packages/react-server/src/ReactFlightServerConfigStream.js
+4 -2
@@ -94,7 +94,8 @@ export function processModelChunk(
94 id: number,
95 model: ReactModel,
96 ): Chunk {
97 - const json = stringify(model, request.toJSON);
97 + // $FlowFixMe: `json` might be `undefined` when model is a symbol.
98 + const json: string = stringify(model, request.toJSON);
99 const row = serializeRowHeader('J', id) + json + '\n';
100 return stringToChunk(row);
101 }
@@ -114,7 +115,8 @@ export function processModuleChunk(
115 id: number,
116 moduleMetaData: ReactModel,
117 ): Chunk {
117 - const json = stringify(moduleMetaData);
118 + // $FlowFixMe: `json` might be `undefined` when moduleMetaData is a symbol.
119 + const json: string = stringify(moduleMetaData);
120 const row = serializeRowHeader('M', id) + json + '\n';
121 return stringToChunk(row);
122 }
packages/react-test-renderer/src/ReactTestRenderer.js
+1 -1
@@ -65,7 +65,7 @@ type ReactTestRendererJSON = {|
65 type: string,
66 props: {[propName: string]: any, ...},
67 children: null | Array<ReactTestRendererNode>,
68 - $$typeof?: Symbol, // Optional because we add it with defineProperty().
68 + $$typeof?: symbol, // Optional because we add it with defineProperty().
69 |};
70 type ReactTestRendererNode = ReactTestRendererJSON | string;
71
packages/react/src/ReactChildren.js
+8 -4
@@ -137,9 +137,12 @@ function mapIntoArray(
137 escapedPrefix +
138 // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
139 (mappedChild.key && (!child || child.key !== mappedChild.key)
140 - ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
141 - // eslint-disable-next-line react-internal/safe-string-coercion
142 - escapeUserProvidedKey('' + mappedChild.key) + '/'
140 + ? escapeUserProvidedKey(
141 + // eslint-disable-next-line react-internal/safe-string-coercion
142 + '' +
143 + // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
144 + mappedChild.key,
145 + ) + '/'
146 : '') +
147 childKey,
148 );
@@ -190,6 +193,7 @@ function mapIntoArray(
193 const iterator = iteratorFn.call(iterableChildren);
194 let step;
195 let ii = 0;
196 + // $FlowFixMe `iteratorFn` might return null according to typing.
197 while (!(step = iterator.next()).done) {
198 child = step.value;
199 nextName = nextNamePrefix + getElementKey(child, ii++);
@@ -222,7 +226,7 @@ function mapIntoArray(
226 return subtreeCount;
227 }
228
225 -type MapFunc = (child: ?React$Node) => ?ReactNodeList;
229 +type MapFunc = (child: ?React$Node, index: number) => ?ReactNodeList;
230
231 /**
232 * Maps children that are typically specified as `props.children`.
packages/react/src/ReactLazy.js
+1 -1
@@ -43,7 +43,7 @@ type Payload<T> =
43 | RejectedPayload;
44
45 export type LazyComponent<T, P> = {
46 - $$typeof: Symbol | number,
46 + $$typeof: symbol | number,
47 _payload: P,
48 _init: (payload: P) => T,
49 };
packages/shared/CheckStringCoercion.js
+1
@@ -26,6 +26,7 @@ function typeName(value: mixed): string {
26 (hasToStringTag && (value: any)[Symbol.toStringTag]) ||
27 (value: any).constructor.name ||
28 'Object';
29 + // $FlowFixMe
30 return type;
31 }
32 }
packages/shared/ReactServerContextRegistry.js
+1
@@ -17,6 +17,7 @@ export function getOrCreateServerContext(globalName: string) {
17 if (!ContextRegistry[globalName]) {
18 ContextRegistry[globalName] = createServerContext(
19 globalName,
20 + // $FlowFixMe function signature doesn't reflect the symbol value
21 REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED,
22 );
23 }
packages/shared/ReactSymbols.js
+1 -1
@@ -40,7 +40,7 @@ export const REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for(
40 const MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
41 const FAUX_ITERATOR_SYMBOL = '@@iterator';
42
43 -export function getIteratorFn(maybeIterable: ?any): ?() => ?Iterator<*> {
43 +export function getIteratorFn(maybeIterable: ?any): ?() => ?Iterator<any> {
44 if (maybeIterable === null || typeof maybeIterable !== 'object') {
45 return null;
46 }
packages/shared/ReactTypes.js
+6 -6
@@ -24,7 +24,7 @@ export type ReactNodeList = ReactEmpty | React$Node;
24 export type ReactText = string | number;
25
26 export type ReactProvider<T> = {
27 - $$typeof: Symbol | number,
27 + $$typeof: symbol | number,
28 type: ReactProviderType<T>,
29 key: null | string,
30 ref: null,
@@ -37,13 +37,13 @@ export type ReactProvider<T> = {
37 };
38
39 export type ReactProviderType<T> = {
40 - $$typeof: Symbol | number,
40 + $$typeof: symbol | number,
41 _context: ReactContext<T>,
42 ...
43 };
44
45 export type ReactConsumer<T> = {
46 - $$typeof: Symbol | number,
46 + $$typeof: symbol | number,
47 type: ReactContext<T>,
48 key: null | string,
49 ref: null,
@@ -55,7 +55,7 @@ export type ReactConsumer<T> = {
55 };
56
57 export type ReactContext<T> = {
58 - $$typeof: Symbol | number,
58 + $$typeof: symbol | number,
59 Consumer: ReactContext<T>,
60 Provider: ReactProviderType<T>,
61 _currentValue: T,
@@ -85,7 +85,7 @@ export type ServerContextJSONValue =
85 export type ReactServerContext<T: any> = ReactContext<T>;
86
87 export type ReactPortal = {
88 - $$typeof: Symbol | number,
88 + $$typeof: symbol | number,
89 key: null | string,
90 containerInfo: any,
91 children: ReactNodeList,
@@ -99,7 +99,7 @@ export type RefObject = {|
99 |};
100
101 export type ReactScope = {|
102 - $$typeof: Symbol | number,
102 + $$typeof: symbol | number,
103 |};
104
105 export type ReactScopeQuery = (
packages/shared/isValidElementType.js
+1 -1
@@ -33,7 +33,7 @@ import {
33 enableLegacyHidden,
34 } from './ReactFeatureFlags';
35
36 -const REACT_MODULE_REFERENCE: Symbol = Symbol.for('react.module.reference');
36 +const REACT_MODULE_REFERENCE: symbol = Symbol.for('react.module.reference');
37
38 export default function isValidElementType(type: mixed) {
39 if (typeof type === 'string' || typeof type === 'function') {
scripts/flow/config/flowconfig
+1 -1
@@ -50,4 +50,4 @@ esproposal.optional_chaining=enable
50 munge_underscores=false
51
52 [version]
53 -^0.97.0
53 +^0.122.0
yarn.lock
+4 -4
@@ -7913,10 +7913,10 @@ flatted@^2.0.0:
7913 resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138"
7914 integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==
7915
7916 -flow-bin@0.97:
7917 - version "0.97.0"
7918 - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.97.0.tgz#036ffcfc27503367a9d906ec9d843a0aa6f6bb83"
7919 - integrity sha512-jXjD05gkatLuC4+e28frH1hZoRwr1iASP6oJr61Q64+kR4kmzaS+AdFBhYgoYS5kpoe4UzwDebWK8ETQFNh00w==
7916 +flow-bin@^0.122:
7917 + version "0.122.0"
7918 + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.122.0.tgz#c723a2b33b1a70bd10204704ae1dc776d5d89d79"
7919 + integrity sha512-my8N5jgl/A+UVby9E7NDppHdhLgRbWgKbmFZSx2MSYMRh3d9YGnM2MM+wexpUpl0ftY1IM6ZcUwaAhrypLyvlA==
7920
7921 fluent-syntax@0.13.0:
7922 version "0.13.0"