@samitouri / QOS-React-2 / commits / 6c00c5bba4

Update to flow-bin@0.89 (#17842)

Nicolas Gallagher committed Jan 22, 2020 at 10:02 UTC 6c00c5bba4d2272de6975c124ab6dc29abb629c8
11 files changed +63 -47
package.json
+1 -1
@@ -57,7 +57,7 @@
57 "eslint-plugin-react-internal": "link:./scripts/eslint-rules",
58 "fbjs-scripts": "^0.8.3",
59 "filesize": "^3.5.6",
60 - "flow-bin": "^0.84.0",
60 + "flow-bin": "0.89",
61 "glob": "^6.0.4",
62 "glob-stream": "^6.1.0",
63 "google-closure-compiler": "20190301.0.0",
packages/react-cache/src/LRU.js
+1 -1
@@ -77,7 +77,7 @@ export function createLRU<T>(limit: number) {
77 }
78 }
79
80 - function add(value: T, onDelete: () => mixed): Entry<T> {
80 + function add(value: Object, onDelete: () => mixed): Entry<Object> {
81 const entry = {
82 value,
83 onDelete,
packages/react-dom/src/client/ReactDOMHostConfig.js
+2 -2
@@ -350,9 +350,9 @@ export const warnsIfNotActing = true;
350 // This initialization code may run even on server environments
351 // if a component just imports ReactDOM (e.g. for findDOMNode).
352 // Some environments might not have setTimeout or clearTimeout.
353 -export const scheduleTimeout =
353 +export const scheduleTimeout: any =
354 typeof setTimeout === 'function' ? setTimeout : (undefined: any);
355 -export const cancelTimeout =
355 +export const cancelTimeout: any =
356 typeof clearTimeout === 'function' ? clearTimeout : (undefined: any);
357 export const noTimeout = -1;
358
packages/react-interactions/events/src/dom/PressLegacy.js
+2
@@ -777,6 +777,7 @@ const pressResponderImpl = {
777
778 // Determine whether to call preventDefault on subsequent native events.
779 if (
780 + target !== null &&
781 context.isTargetWithinResponder(target) &&
782 context.isTargetWithinHostComponent(target, 'a')
783 ) {
@@ -808,6 +809,7 @@ const pressResponderImpl = {
809 if (
810 !isKeyboardEvent &&
811 pressTarget !== null &&
812 + target !== null &&
813 !targetIsDocument(pressTarget)
814 ) {
815 if (
packages/react-native-renderer/src/ReactFabricHostConfig.js
+8 -8
@@ -436,34 +436,34 @@ export function DEPRECATED_unmountResponderInstance(
436 throw new Error('Not yet implemented.');
437 }
438
439 -export function getFundamentalComponentInstance(fundamentalInstance) {
439 +export function getFundamentalComponentInstance(fundamentalInstance: any) {
440 throw new Error('Not yet implemented.');
441 }
442
443 -export function mountFundamentalComponent(fundamentalInstance) {
443 +export function mountFundamentalComponent(fundamentalInstance: any) {
444 throw new Error('Not yet implemented.');
445 }
446
447 -export function shouldUpdateFundamentalComponent(fundamentalInstance) {
447 +export function shouldUpdateFundamentalComponent(fundamentalInstance: any) {
448 throw new Error('Not yet implemented.');
449 }
450
451 -export function updateFundamentalComponent(fundamentalInstance) {
451 +export function updateFundamentalComponent(fundamentalInstance: any) {
452 throw new Error('Not yet implemented.');
453 }
454
455 -export function unmountFundamentalComponent(fundamentalInstance) {
455 +export function unmountFundamentalComponent(fundamentalInstance: any) {
456 throw new Error('Not yet implemented.');
457 }
458
459 -export function cloneFundamentalInstance(fundamentalInstance) {
459 +export function cloneFundamentalInstance(fundamentalInstance: any) {
460 throw new Error('Not yet implemented.');
461 }
462
463 -export function getInstanceFromNode(node) {
463 +export function getInstanceFromNode(node: any) {
464 throw new Error('Not yet implemented.');
465 }
466
467 -export function beforeRemoveInstance(instance) {
467 +export function beforeRemoveInstance(instance: any) {
468 // noop
469 }
packages/react-native-renderer/src/ReactNativeHostConfig.js
+7 -7
@@ -493,30 +493,30 @@ export function DEPRECATED_unmountResponderInstance(
493 throw new Error('Not yet implemented.');
494 }
495
496 -export function getFundamentalComponentInstance(fundamentalInstance) {
496 +export function getFundamentalComponentInstance(fundamentalInstance: any) {
497 throw new Error('Not yet implemented.');
498 }
499
500 -export function mountFundamentalComponent(fundamentalInstance) {
500 +export function mountFundamentalComponent(fundamentalInstance: any) {
501 throw new Error('Not yet implemented.');
502 }
503
504 -export function shouldUpdateFundamentalComponent(fundamentalInstance) {
504 +export function shouldUpdateFundamentalComponent(fundamentalInstance: any) {
505 throw new Error('Not yet implemented.');
506 }
507
508 -export function updateFundamentalComponent(fundamentalInstance) {
508 +export function updateFundamentalComponent(fundamentalInstance: any) {
509 throw new Error('Not yet implemented.');
510 }
511
512 -export function unmountFundamentalComponent(fundamentalInstance) {
512 +export function unmountFundamentalComponent(fundamentalInstance: any) {
513 throw new Error('Not yet implemented.');
514 }
515
516 -export function getInstanceFromNode(node) {
516 +export function getInstanceFromNode(node: any) {
517 throw new Error('Not yet implemented.');
518 }
519
520 -export function beforeRemoveInstance(instance) {
520 +export function beforeRemoveInstance(instance: any) {
521 // noop
522 }
packages/react-test-renderer/src/ReactTestHostConfig.js
+4 -2
@@ -316,7 +316,9 @@ export function DEPRECATED_unmountResponderInstance(
316 // noop
317 }
318
319 -export function getFundamentalComponentInstance(fundamentalInstance): Instance {
319 +export function getFundamentalComponentInstance(
320 + fundamentalInstance: ReactFundamentalComponentInstance<any, any>,
321 +): Instance {
322 const {impl, props, state} = fundamentalInstance;
323 return impl.getInstance(null, props, state);
324 }
@@ -370,6 +372,6 @@ export function getInstanceFromNode(mockNode: Object) {
372 return null;
373 }
374
373 -export function beforeRemoveInstance(instance) {
375 +export function beforeRemoveInstance(instance: any) {
376 // noop
377 }
packages/react/src/ReactHooks.js
+29 -21
@@ -17,6 +17,9 @@ import {REACT_RESPONDER_TYPE} from 'shared/ReactSymbols';
17
18 import ReactCurrentDispatcher from './ReactCurrentDispatcher';
19
20 +type BasicStateAction<S> = (S => S) | S;
21 +type Dispatch<A> = A => void;
22 +
23 function resolveDispatcher() {
24 const dispatcher = ReactCurrentDispatcher.current;
25 invariant(
@@ -72,7 +75,9 @@ export function useContext<T>(
75 return dispatcher.useContext(Context, unstable_observedBits);
76 }
77
75 -export function useState<S>(initialState: (() => S) | S) {
78 +export function useState<S>(
79 + initialState: (() => S) | S,
80 +): [S, Dispatch<BasicStateAction<S>>] {
81 const dispatcher = resolveDispatcher();
82 return dispatcher.useState(initialState);
83 }
@@ -81,7 +86,7 @@ export function useReducer<S, I, A>(
86 reducer: (S, A) => S,
87 initialArg: I,
88 init?: I => S,
84 -) {
89 +): [S, Dispatch<A>] {
90 const dispatcher = resolveDispatcher();
91 return dispatcher.useReducer(reducer, initialArg, init);
92 }
@@ -93,46 +98,49 @@ export function useRef<T>(initialValue: T): {|current: T|} {
98
99 export function useEffect(
100 create: () => (() => void) | void,
96 - inputs: Array<mixed> | void | null,
97 -) {
101 + deps: Array<mixed> | void | null,
102 +): void {
103 const dispatcher = resolveDispatcher();
99 - return dispatcher.useEffect(create, inputs);
104 + return dispatcher.useEffect(create, deps);
105 }
106
107 export function useLayoutEffect(
108 create: () => (() => void) | void,
104 - inputs: Array<mixed> | void | null,
105 -) {
109 + deps: Array<mixed> | void | null,
110 +): void {
111 const dispatcher = resolveDispatcher();
107 - return dispatcher.useLayoutEffect(create, inputs);
112 + return dispatcher.useLayoutEffect(create, deps);
113 }
114
110 -export function useCallback(
111 - callback: () => mixed,
112 - inputs: Array<mixed> | void | null,
113 -) {
115 +export function useCallback<T>(
116 + callback: T,
117 + deps: Array<mixed> | void | null,
118 +): T {
119 const dispatcher = resolveDispatcher();
115 - return dispatcher.useCallback(callback, inputs);
120 + return dispatcher.useCallback(callback, deps);
121 }
122
118 -export function useMemo(
119 - create: () => mixed,
120 - inputs: Array<mixed> | void | null,
121 -) {
123 +export function useMemo<T>(
124 + create: () => T,
125 + deps: Array<mixed> | void | null,
126 +): T {
127 const dispatcher = resolveDispatcher();
123 - return dispatcher.useMemo(create, inputs);
128 + return dispatcher.useMemo(create, deps);
129 }
130
131 export function useImperativeHandle<T>(
132 ref: {|current: T | null|} | ((inst: T | null) => mixed) | null | void,
133 create: () => T,
129 - inputs: Array<mixed> | void | null,
134 + deps: Array<mixed> | void | null,
135 ): void {
136 const dispatcher = resolveDispatcher();
132 - return dispatcher.useImperativeHandle(ref, create, inputs);
137 + return dispatcher.useImperativeHandle(ref, create, deps);
138 }
139
135 -export function useDebugValue(value: any, formatterFn: ?(value: any) => any) {
140 +export function useDebugValue<T>(
141 + value: T,
142 + formatterFn: ?(value: T) => mixed,
143 +): void {
144 if (__DEV__) {
145 const dispatcher = resolveDispatcher();
146 return dispatcher.useDebugValue(value, formatterFn);
scripts/flow/config/flowconfig
+1 -1
@@ -50,4 +50,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
50 suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
51
52 [version]
53 -^0.84.0
\ No newline at end of file
53 +^0.89.0
scripts/flow/environment.js
+4
@@ -17,6 +17,10 @@ declare var __REACT_DEVTOOLS_GLOBAL_HOOK__: any; /*?{
17 inject: ?((stuff: Object) => void)
18 };*/
19
20 +declare module 'create-react-class' {
21 + declare var exports: React$CreateClass;
22 +}
23 +
24 declare var trustedTypes: {|
25 isHTML: (value: any) => boolean,
26 isScript: (value: any) => boolean,
yarn.lock
+4 -4
@@ -5725,10 +5725,10 @@ flatted@^2.0.0:
5725 resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08"
5726 integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==
5727
5728 -flow-bin@^0.84.0:
5729 - version "0.84.0"
5730 - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.84.0.tgz#4cb2364c750fb37a7840524fa62456b53f64cdcb"
5731 - integrity sha512-ocji8eEYp+YfICsm+F6cIHUcD7v5sb0/ADEXm6gyUKdjQzmSckMrPUdZtyfP973t3YGHKliUMxMvIBHyR5LbXQ==
5728 +flow-bin@0.89:
5729 + version "0.89.0"
5730 + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.89.0.tgz#6bd29c2af7e0f429797f820662f33749105c32fa"
5731 + integrity sha512-DkO4PsXYrl53V6G5+t5HbRMC5ajYUQej2LEGPUZ+j9okTb41Sn5j9vfxsCpXMEAslYnQoysHhYu4GUZsQX/DrQ==
5732
5733 fluent-syntax@0.13.0:
5734 version "0.13.0"