Skip to content

Commit 6faf6f5

Browse files
authored
Update to flow 0.97 (#17892)
1 parent 81e30c7 commit 6faf6f5

File tree

9 files changed

+17
-9
lines changed

9 files changed

+17
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
5858
"fbjs-scripts": "0.8.3",
5959
"filesize": "^6.0.1",
60-
"flow-bin": "0.89",
60+
"flow-bin": "0.97",
6161
"glob": "^7.1.6",
6262
"glob-stream": "^6.1.0",
6363
"google-closure-compiler": "20190301.0.0",

packages/react-debug-tools/src/ReactDebugHooks.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ function useState<S>(
117117
hook !== null
118118
? hook.memoizedState
119119
: typeof initialState === 'function'
120-
? initialState()
120+
? // $FlowFixMe: Flow doesn't like mixed types
121+
initialState()
121122
: initialState;
122123
hookLog.push({primitive: 'State', stackError: new Error(), value: state});
123124
return [state, (action: BasicStateAction<S>) => {}];

packages/react-dom/src/server/ReactPartialRendererHooks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ function useContext<T>(
247247
}
248248

249249
function basicStateReducer<S>(state: S, action: BasicStateAction<S>): S {
250+
// $FlowFixMe: Flow doesn't like mixed types
250251
return typeof action === 'function' ? action(state) : action;
251252
}
252253

packages/react-reconciler/src/ReactFiberHooks.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ function createFunctionComponentUpdateQueue(): FunctionComponentUpdateQueue {
623623
}
624624

625625
function basicStateReducer<S>(state: S, action: BasicStateAction<S>): S {
626+
// $FlowFixMe: Flow doesn't like mixed types
626627
return typeof action === 'function' ? action(state) : action;
627628
}
628629

@@ -843,6 +844,7 @@ function mountState<S>(
843844
): [S, Dispatch<BasicStateAction<S>>] {
844845
const hook = mountWorkInProgressHook();
845846
if (typeof initialState === 'function') {
847+
// $FlowFixMe: Flow doesn't like mixed types
846848
initialState = initialState();
847849
}
848850
hook.memoizedState = hook.baseState = initialState;

packages/react-test-renderer/src/ReactShallowRenderer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ function createHook(): Hook {
173173
}
174174

175175
function basicStateReducer<S>(state: S, action: BasicStateAction<S>): S {
176+
// $FlowFixMe: Flow doesn't like mixed types
176177
return typeof action === 'function' ? action(state) : action;
177178
}
178179

packages/shared/getComponentName.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function getComponentName(type: mixed): string | null {
5151
}
5252
}
5353
if (typeof type === 'function') {
54-
return type.displayName || type.name || null;
54+
return (type: any).displayName || type.name || null;
5555
}
5656
if (typeof type === 'string') {
5757
return type;

packages/shared/objectIs.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@ function is(x: any, y: any) {
1717
);
1818
}
1919

20-
export default typeof Object.is === 'function' ? Object.is : is;
20+
const objectIs: (x: any, y: any) => boolean =
21+
typeof Object.is === 'function' ? Object.is : is;
22+
23+
export default objectIs;

scripts/flow/config/flowconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
5050
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
5151

5252
[version]
53-
^0.89.0
53+
^0.97.0

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5886,10 +5886,10 @@ flatted@^2.0.0:
58865886
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08"
58875887
integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==
58885888

5889-
flow-bin@0.89:
5890-
version "0.89.0"
5891-
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.89.0.tgz#6bd29c2af7e0f429797f820662f33749105c32fa"
5892-
integrity sha512-DkO4PsXYrl53V6G5+t5HbRMC5ajYUQej2LEGPUZ+j9okTb41Sn5j9vfxsCpXMEAslYnQoysHhYu4GUZsQX/DrQ==
5889+
flow-bin@0.97:
5890+
version "0.97.0"
5891+
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.97.0.tgz#036ffcfc27503367a9d906ec9d843a0aa6f6bb83"
5892+
integrity sha512-jXjD05gkatLuC4+e28frH1hZoRwr1iASP6oJr61Q64+kR4kmzaS+AdFBhYgoYS5kpoe4UzwDebWK8ETQFNh00w==
58935893

58945894
58955895
version "0.13.0"

0 commit comments

Comments
 (0)