diff --git a/package.json b/package.json index 2e8445521b0a0..47514e3ec2d3a 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "eslint-plugin-react-internal": "link:./scripts/eslint-rules", "fbjs-scripts": "1.2.0", "filesize": "^6.0.1", - "flow-bin": "0.97", + "flow-bin": "^0.122", "glob": "^7.1.6", "glob-stream": "^6.1.0", "google-closure-compiler": "^20200517.0.0", diff --git a/packages/jest-react/src/internalAct.js b/packages/jest-react/src/internalAct.js index 4e41f6234c928..a5a398b7e2a0d 100644 --- a/packages/jest-react/src/internalAct.js +++ b/packages/jest-react/src/internalAct.js @@ -28,6 +28,8 @@ export function act(scope: () => Thenable | T): Thenable { 'This version of `act` requires a special mock build of Scheduler.', ); } + + // $FlowFixMe: _isMockFunction doesn't exist on function if (setTimeout._isMockFunction !== true) { throw Error( "This version of `act` requires Jest's timer mocks " + diff --git a/packages/react-debug-tools/src/ReactDebugHooks.js b/packages/react-debug-tools/src/ReactDebugHooks.js index 940873725cb2f..7cfb576fad378 100644 --- a/packages/react-debug-tools/src/ReactDebugHooks.js +++ b/packages/react-debug-tools/src/ReactDebugHooks.js @@ -683,6 +683,7 @@ function handleRenderFunctionError(error: any): void { // TODO: refactor this if we ever combine the devtools and debug tools packages wrapperError.name = 'ReactDebugToolsRenderError'; // this stage-4 proposal is not supported by all environments yet. + // $FlowFixMe Flow doesn't have this type yet. wrapperError.cause = error; throw wrapperError; } diff --git a/packages/react-devtools-shared/src/backend/StyleX/utils.js b/packages/react-devtools-shared/src/backend/StyleX/utils.js index 68bda23a2262c..2167321b0c84d 100644 --- a/packages/react-devtools-shared/src/backend/StyleX/utils.js +++ b/packages/react-devtools-shared/src/backend/StyleX/utils.js @@ -92,7 +92,9 @@ function getPropertyValueForStyleName(styleName: string): string | null { ]: any): CSSStyleSheet); // $FlowFixMe Flow doesn't konw about these properties const rules = styleSheet.rules || styleSheet.cssRules; + // $FlowFixMe `rules` is mixed for (let ruleIndex = 0; ruleIndex < rules.length; ruleIndex++) { + // $FlowFixMe `rules` is mixed const rule = rules[ruleIndex]; // $FlowFixMe Flow doesn't konw about these properties const {cssText, selectorText, style} = rule; diff --git a/packages/react-devtools-shared/src/backend/renderer.js b/packages/react-devtools-shared/src/backend/renderer.js index 3a893060da0ad..9802d4b8c03d9 100644 --- a/packages/react-devtools-shared/src/backend/renderer.js +++ b/packages/react-devtools-shared/src/backend/renderer.js @@ -124,7 +124,7 @@ import type { } from 'react-devtools-shared/src/types'; type getDisplayNameForFiberType = (fiber: Fiber) => string | null; -type getTypeSymbolType = (type: any) => Symbol | number; +type getTypeSymbolType = (type: any) => symbol | number; type ReactPriorityLevelsType = {| ImmediatePriority: number, @@ -382,13 +382,14 @@ export function getInternalReactConstants( // End of copied code. // ********************************************************** - function getTypeSymbol(type: any): Symbol | number { + function getTypeSymbol(type: any): symbol | number { const symbolOrNumber = typeof type === 'object' && type !== null ? type.$$typeof : type; // $FlowFixMe Flow doesn't know about typeof "symbol" return typeof symbolOrNumber === 'symbol' - ? symbolOrNumber.toString() + ? // $FlowFixMe `toString()` doesn't match the type signature? + symbolOrNumber.toString() : symbolOrNumber; } diff --git a/packages/react-devtools-shared/src/backend/types.js b/packages/react-devtools-shared/src/backend/types.js index 81ed15b04ae78..be71a816d6327 100644 --- a/packages/react-devtools-shared/src/backend/types.js +++ b/packages/react-devtools-shared/src/backend/types.js @@ -84,7 +84,7 @@ export type GetFiberIDForNative = ( export type FindNativeNodesForFiberID = (id: number) => ?Array; export type ReactProviderType = { - $$typeof: Symbol | number, + $$typeof: symbol | number, _context: ReactContext, ... }; diff --git a/packages/react-devtools-shared/src/devtools/views/Button.js b/packages/react-devtools-shared/src/devtools/views/Button.js index 82400bb8982a2..bdd84b57da431 100644 --- a/packages/react-devtools-shared/src/devtools/views/Button.js +++ b/packages/react-devtools-shared/src/devtools/views/Button.js @@ -28,6 +28,7 @@ export default function Button({ ...rest }: Props) { let button = ( + // $FlowFixMe unsafe spread