Skip to content

Commit

Permalink
Update to flow 0.97 (#17892)
Browse files Browse the repository at this point in the history
  • Loading branch information
necolas authored Jan 24, 2020
1 parent 81e30c7 commit 6faf6f5
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
"fbjs-scripts": "0.8.3",
"filesize": "^6.0.1",
"flow-bin": "0.89",
"flow-bin": "0.97",
"glob": "^7.1.6",
"glob-stream": "^6.1.0",
"google-closure-compiler": "20190301.0.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/react-debug-tools/src/ReactDebugHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ function useState<S>(
hook !== null
? hook.memoizedState
: typeof initialState === 'function'
? initialState()
? // $FlowFixMe: Flow doesn't like mixed types
initialState()
: initialState;
hookLog.push({primitive: 'State', stackError: new Error(), value: state});
return [state, (action: BasicStateAction<S>) => {}];
Expand Down
1 change: 1 addition & 0 deletions packages/react-dom/src/server/ReactPartialRendererHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ function useContext<T>(
}

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

Expand Down
2 changes: 2 additions & 0 deletions packages/react-reconciler/src/ReactFiberHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@ function createFunctionComponentUpdateQueue(): FunctionComponentUpdateQueue {
}

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

Expand Down Expand Up @@ -843,6 +844,7 @@ function mountState<S>(
): [S, Dispatch<BasicStateAction<S>>] {
const hook = mountWorkInProgressHook();
if (typeof initialState === 'function') {
// $FlowFixMe: Flow doesn't like mixed types
initialState = initialState();
}
hook.memoizedState = hook.baseState = initialState;
Expand Down
1 change: 1 addition & 0 deletions packages/react-test-renderer/src/ReactShallowRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ function createHook(): Hook {
}

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

Expand Down
2 changes: 1 addition & 1 deletion packages/shared/getComponentName.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function getComponentName(type: mixed): string | null {
}
}
if (typeof type === 'function') {
return type.displayName || type.name || null;
return (type: any).displayName || type.name || null;
}
if (typeof type === 'string') {
return type;
Expand Down
5 changes: 4 additions & 1 deletion packages/shared/objectIs.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ function is(x: any, y: any) {
);
}

export default typeof Object.is === 'function' ? Object.is : is;
const objectIs: (x: any, y: any) => boolean =
typeof Object.is === 'function' ? Object.is : is;

export default objectIs;
2 changes: 1 addition & 1 deletion scripts/flow/config/flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

[version]
^0.89.0
^0.97.0
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5886,10 +5886,10 @@ flatted@^2.0.0:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08"
integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==

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

[email protected]:
version "0.13.0"
Expand Down

0 comments on commit 6faf6f5

Please sign in to comment.