From 9813edef2964d5d01308540e4eb7804dfc95425f Mon Sep 17 00:00:00 2001 From: Jan Kassens Date: Tue, 4 Oct 2022 15:39:26 -0400 Subject: [PATCH] Flow upgrade to 0.188 ghstack-source-id: 5c359b97cc0a2587cf55ff879c863415a2c13127 Pull Request resolved: https://github.com/facebook/react/pull/25423 --- package.json | 2 +- packages/react-devtools-core/src/editor.js | 1 + .../src/backend/DevToolsComponentStackFrame.js | 1 + .../src/app/DeeplyNestedComponents/index.js | 1 + .../src/app/InspectableElements/CustomHooks.js | 1 + packages/react-dom-bindings/src/events/SyntheticEvent.js | 1 + packages/react-dom/src/client/ReactDOMRoot.js | 3 +++ packages/react-pg/src/ReactPostgres.js | 1 + packages/react-reconciler/src/ReactFiberCommitWork.new.js | 1 + packages/react-reconciler/src/ReactFiberCommitWork.old.js | 1 + packages/react-reconciler/src/ReactFiberHooks.new.js | 1 + packages/react-reconciler/src/ReactFiberHooks.old.js | 1 + packages/react-reconciler/src/ReactFiberWorkLoop.new.js | 2 ++ packages/react-reconciler/src/ReactFiberWorkLoop.old.js | 2 ++ packages/shared/ReactComponentStackFrame.js | 1 + scripts/flow/config/flowconfig | 2 +- yarn.lock | 8 ++++---- 17 files changed, 24 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index b8260ff5c0f4d..b3288286d7842 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.185.0", + "flow-bin": "^0.188.0", "glob": "^7.1.6", "glob-stream": "^6.1.0", "google-closure-compiler": "^20200517.0.0", diff --git a/packages/react-devtools-core/src/editor.js b/packages/react-devtools-core/src/editor.js index 1867551e57385..f424208bc943d 100644 --- a/packages/react-devtools-core/src/editor.js +++ b/packages/react-devtools-core/src/editor.js @@ -173,6 +173,7 @@ export function launchEditor( // There's an existing editor process already and it's attached // to the terminal, so go kill it. Otherwise two separate editor // instances attach to the stdin/stdout which gets confusing. + // $FlowFixMe[incompatible-use] found when upgrading Flow childProcess.kill('SIGKILL'); } diff --git a/packages/react-devtools-shared/src/backend/DevToolsComponentStackFrame.js b/packages/react-devtools-shared/src/backend/DevToolsComponentStackFrame.js index 1c5631e84f833..3b529bd618e41 100644 --- a/packages/react-devtools-shared/src/backend/DevToolsComponentStackFrame.js +++ b/packages/react-devtools-shared/src/backend/DevToolsComponentStackFrame.js @@ -121,6 +121,7 @@ export function describeNativeComponentFrame( } catch (x) { control = x; } + // $FlowFixMe[prop-missing] found when upgrading Flow fn.call(Fake.prototype); } } else { diff --git a/packages/react-devtools-shell/src/app/DeeplyNestedComponents/index.js b/packages/react-devtools-shell/src/app/DeeplyNestedComponents/index.js index 03cc54c1500e1..dda89a3cd48e6 100644 --- a/packages/react-devtools-shell/src/app/DeeplyNestedComponents/index.js +++ b/packages/react-devtools-shell/src/app/DeeplyNestedComponents/index.js @@ -18,6 +18,7 @@ function wrapWithHoc(Component, index) { // $FlowFixMe const displayName = Component.displayName || Component.name; + // $FlowFixMe[incompatible-type] found when upgrading Flow HOC.displayName = `withHoc${index}(${displayName})`; return HOC; } diff --git a/packages/react-devtools-shell/src/app/InspectableElements/CustomHooks.js b/packages/react-devtools-shell/src/app/InspectableElements/CustomHooks.js index 9b76deb01dd0d..04e586853f5be 100644 --- a/packages/react-devtools-shell/src/app/InspectableElements/CustomHooks.js +++ b/packages/react-devtools-shell/src/app/InspectableElements/CustomHooks.js @@ -109,6 +109,7 @@ function wrapWithHoc(Component) { } // $FlowFixMe const displayName = Component.displayName || Component.name; + // $FlowFixMe[incompatible-type] found when upgrading Flow Hoc.displayName = `withHoc(${displayName})`; return Hoc; } diff --git a/packages/react-dom-bindings/src/events/SyntheticEvent.js b/packages/react-dom-bindings/src/events/SyntheticEvent.js index 2d75b647aca80..c7263dda2da46 100644 --- a/packages/react-dom-bindings/src/events/SyntheticEvent.js +++ b/packages/react-dom-bindings/src/events/SyntheticEvent.js @@ -81,6 +81,7 @@ function createSyntheticEvent(Interface: EventInterfaceType) { return this; } + // $FlowFixMe[prop-missing] found when upgrading Flow assign(SyntheticBaseEvent.prototype, { preventDefault: function() { this.defaultPrevented = true; diff --git a/packages/react-dom/src/client/ReactDOMRoot.js b/packages/react-dom/src/client/ReactDOMRoot.js index 13498ae1fa96e..ddd52b76865e9 100644 --- a/packages/react-dom/src/client/ReactDOMRoot.js +++ b/packages/react-dom/src/client/ReactDOMRoot.js @@ -94,6 +94,7 @@ function ReactDOMRoot(internalRoot: FiberRoot) { this._internalRoot = internalRoot; } +// $FlowFixMe[prop-missing] found when upgrading Flow ReactDOMHydrationRoot.prototype.render = ReactDOMRoot.prototype.render = function( children: ReactNodeList, ): void { @@ -139,6 +140,7 @@ ReactDOMHydrationRoot.prototype.render = ReactDOMRoot.prototype.render = functio updateContainer(children, root, null, null); }; +// $FlowFixMe[prop-missing] found when upgrading Flow ReactDOMHydrationRoot.prototype.unmount = ReactDOMRoot.prototype.unmount = function(): void { if (__DEV__) { if (typeof arguments[0] === 'function') { @@ -260,6 +262,7 @@ function scheduleHydration(target: Node) { queueExplicitHydrationTarget(target); } } +// $FlowFixMe[prop-missing] found when upgrading Flow ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = scheduleHydration; export function hydrateRoot( diff --git a/packages/react-pg/src/ReactPostgres.js b/packages/react-pg/src/ReactPostgres.js index 46426817ee43f..c3d2e3557f275 100644 --- a/packages/react-pg/src/ReactPostgres.js +++ b/packages/react-pg/src/ReactPostgres.js @@ -77,6 +77,7 @@ export function Pool(options: mixed) { type NestedMap = Map; +// $FlowFixMe[prop-missing] found when upgrading Flow Pool.prototype.query = function(query: string, values?: Array) { const pool = this.pool; const outerMap = unstable_getCacheForType(this.createRecordMap); diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.new.js b/packages/react-reconciler/src/ReactFiberCommitWork.new.js index 3a7a696c05c30..4066f37b3b02a 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.new.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.new.js @@ -1237,6 +1237,7 @@ function abortRootTransitions( transitionInstance.pendingBoundaries !== null && transitionInstance.pendingBoundaries.has(deletedOffscreenInstance) ) { + // $FlowFixMe[incompatible-use] found when upgrading Flow transitionInstance.pendingBoundaries.delete( deletedOffscreenInstance, ); diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.old.js b/packages/react-reconciler/src/ReactFiberCommitWork.old.js index 22c91330f1d20..0fd77ff2dd1d4 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.old.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.old.js @@ -1237,6 +1237,7 @@ function abortRootTransitions( transitionInstance.pendingBoundaries !== null && transitionInstance.pendingBoundaries.has(deletedOffscreenInstance) ) { + // $FlowFixMe[incompatible-use] found when upgrading Flow transitionInstance.pendingBoundaries.delete( deletedOffscreenInstance, ); diff --git a/packages/react-reconciler/src/ReactFiberHooks.new.js b/packages/react-reconciler/src/ReactFiberHooks.new.js index 0c676de1a48da..7ed2249524d8b 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.new.js +++ b/packages/react-reconciler/src/ReactFiberHooks.new.js @@ -1944,6 +1944,7 @@ function mountEvent) => Return>( "A function wrapped in useEvent can't be called during rendering.", ); } + // $FlowFixMe[prop-missing] found when upgrading Flow return eventFn._impl.apply(undefined, arguments); }; eventFn._impl = callback; diff --git a/packages/react-reconciler/src/ReactFiberHooks.old.js b/packages/react-reconciler/src/ReactFiberHooks.old.js index e0a1ee6070a30..559b96fb1a209 100644 --- a/packages/react-reconciler/src/ReactFiberHooks.old.js +++ b/packages/react-reconciler/src/ReactFiberHooks.old.js @@ -1944,6 +1944,7 @@ function mountEvent) => Return>( "A function wrapped in useEvent can't be called during rendering.", ); } + // $FlowFixMe[prop-missing] found when upgrading Flow return eventFn._impl.apply(undefined, arguments); }; eventFn._impl = callback; diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js index 6cbe3fad2741a..90591f8f0ba76 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.new.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.new.js @@ -1425,6 +1425,7 @@ function markRootSuspended(root, suspendedLanes) { suspendedLanes, workInProgressRootInterleavedUpdatedLanes, ); + // $FlowFixMe[incompatible-call] found when upgrading Flow markRootSuspended_dontCallThisOneDirectly(root, suspendedLanes); } @@ -2066,6 +2067,7 @@ function workLoopConcurrent() { } while (workInProgress !== null && !shouldYield()) { + // $FlowFixMe[incompatible-call] found when upgrading Flow performUnitOfWork(workInProgress); } } diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js index 100b9c7b6f4e4..49b62e545e0bb 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.old.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.old.js @@ -1425,6 +1425,7 @@ function markRootSuspended(root, suspendedLanes) { suspendedLanes, workInProgressRootInterleavedUpdatedLanes, ); + // $FlowFixMe[incompatible-call] found when upgrading Flow markRootSuspended_dontCallThisOneDirectly(root, suspendedLanes); } @@ -2066,6 +2067,7 @@ function workLoopConcurrent() { } while (workInProgress !== null && !shouldYield()) { + // $FlowFixMe[incompatible-call] found when upgrading Flow performUnitOfWork(workInProgress); } } diff --git a/packages/shared/ReactComponentStackFrame.js b/packages/shared/ReactComponentStackFrame.js index ddf2d094d2a92..e1f067f2654a5 100644 --- a/packages/shared/ReactComponentStackFrame.js +++ b/packages/shared/ReactComponentStackFrame.js @@ -123,6 +123,7 @@ export function describeNativeComponentFrame( } catch (x) { control = x; } + // $FlowFixMe[prop-missing] found when upgrading Flow fn.call(Fake.prototype); } } else { diff --git a/scripts/flow/config/flowconfig b/scripts/flow/config/flowconfig index 92d91ac8a086a..5525dd81e6016 100644 --- a/scripts/flow/config/flowconfig +++ b/scripts/flow/config/flowconfig @@ -48,4 +48,4 @@ munge_underscores=false %REACT_RENDERER_FLOW_OPTIONS% [version] -^0.185.0 +^0.188.0 diff --git a/yarn.lock b/yarn.lock index 992fb5c4adfd0..49abd32449176 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7912,10 +7912,10 @@ flatted@^2.0.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== -flow-bin@^0.185.0: - version "0.185.2" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.185.2.tgz#b45a07d45cf641198e86e47848e35f64b0688c4c" - integrity sha512-Vphs8Z4Qo17dzlPKe/l8M85JvGn1Tf5NV6xESZLg8p9ktdIbNUYaxnq/WBQPoESiLrGdrC2v+rfezfh3tvxkvQ== +flow-bin@^0.188.0: + version "0.188.1" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.188.1.tgz#1043ec955eec8cd402ec9fb4c49054bf14368c06" + integrity sha512-tQehbFoeXKz/MZqEClBB2ezuT1HHKoBlv6t8mAoUdFk1PaFhqcEmjx+1Bn0xygykrqHy0FY6C3z+AGleOnFbdQ== fluent-syntax@0.13.0: version "0.13.0"