Skip to content

Commit 6c00c5b

Browse files
authored
1 parent cf7a0c2 commit 6c00c5b

File tree

11 files changed

+63
-47
lines changed

11 files changed

+63
-47
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": "^3.5.6",
60-
"flow-bin": "^0.84.0",
60+
"flow-bin": "0.89",
6161
"glob": "^6.0.4",
6262
"glob-stream": "^6.1.0",
6363
"google-closure-compiler": "20190301.0.0",

packages/react-cache/src/LRU.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export function createLRU<T>(limit: number) {
7777
}
7878
}
7979

80-
function add(value: T, onDelete: () => mixed): Entry<T> {
80+
function add(value: Object, onDelete: () => mixed): Entry<Object> {
8181
const entry = {
8282
value,
8383
onDelete,

packages/react-dom/src/client/ReactDOMHostConfig.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,9 @@ export const warnsIfNotActing = true;
350350
// This initialization code may run even on server environments
351351
// if a component just imports ReactDOM (e.g. for findDOMNode).
352352
// Some environments might not have setTimeout or clearTimeout.
353-
export const scheduleTimeout =
353+
export const scheduleTimeout: any =
354354
typeof setTimeout === 'function' ? setTimeout : (undefined: any);
355-
export const cancelTimeout =
355+
export const cancelTimeout: any =
356356
typeof clearTimeout === 'function' ? clearTimeout : (undefined: any);
357357
export const noTimeout = -1;
358358

packages/react-interactions/events/src/dom/PressLegacy.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,7 @@ const pressResponderImpl = {
777777

778778
// Determine whether to call preventDefault on subsequent native events.
779779
if (
780+
target !== null &&
780781
context.isTargetWithinResponder(target) &&
781782
context.isTargetWithinHostComponent(target, 'a')
782783
) {
@@ -808,6 +809,7 @@ const pressResponderImpl = {
808809
if (
809810
!isKeyboardEvent &&
810811
pressTarget !== null &&
812+
target !== null &&
811813
!targetIsDocument(pressTarget)
812814
) {
813815
if (

packages/react-native-renderer/src/ReactFabricHostConfig.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -436,34 +436,34 @@ export function DEPRECATED_unmountResponderInstance(
436436
throw new Error('Not yet implemented.');
437437
}
438438

439-
export function getFundamentalComponentInstance(fundamentalInstance) {
439+
export function getFundamentalComponentInstance(fundamentalInstance: any) {
440440
throw new Error('Not yet implemented.');
441441
}
442442

443-
export function mountFundamentalComponent(fundamentalInstance) {
443+
export function mountFundamentalComponent(fundamentalInstance: any) {
444444
throw new Error('Not yet implemented.');
445445
}
446446

447-
export function shouldUpdateFundamentalComponent(fundamentalInstance) {
447+
export function shouldUpdateFundamentalComponent(fundamentalInstance: any) {
448448
throw new Error('Not yet implemented.');
449449
}
450450

451-
export function updateFundamentalComponent(fundamentalInstance) {
451+
export function updateFundamentalComponent(fundamentalInstance: any) {
452452
throw new Error('Not yet implemented.');
453453
}
454454

455-
export function unmountFundamentalComponent(fundamentalInstance) {
455+
export function unmountFundamentalComponent(fundamentalInstance: any) {
456456
throw new Error('Not yet implemented.');
457457
}
458458

459-
export function cloneFundamentalInstance(fundamentalInstance) {
459+
export function cloneFundamentalInstance(fundamentalInstance: any) {
460460
throw new Error('Not yet implemented.');
461461
}
462462

463-
export function getInstanceFromNode(node) {
463+
export function getInstanceFromNode(node: any) {
464464
throw new Error('Not yet implemented.');
465465
}
466466

467-
export function beforeRemoveInstance(instance) {
467+
export function beforeRemoveInstance(instance: any) {
468468
// noop
469469
}

packages/react-native-renderer/src/ReactNativeHostConfig.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -493,30 +493,30 @@ export function DEPRECATED_unmountResponderInstance(
493493
throw new Error('Not yet implemented.');
494494
}
495495

496-
export function getFundamentalComponentInstance(fundamentalInstance) {
496+
export function getFundamentalComponentInstance(fundamentalInstance: any) {
497497
throw new Error('Not yet implemented.');
498498
}
499499

500-
export function mountFundamentalComponent(fundamentalInstance) {
500+
export function mountFundamentalComponent(fundamentalInstance: any) {
501501
throw new Error('Not yet implemented.');
502502
}
503503

504-
export function shouldUpdateFundamentalComponent(fundamentalInstance) {
504+
export function shouldUpdateFundamentalComponent(fundamentalInstance: any) {
505505
throw new Error('Not yet implemented.');
506506
}
507507

508-
export function updateFundamentalComponent(fundamentalInstance) {
508+
export function updateFundamentalComponent(fundamentalInstance: any) {
509509
throw new Error('Not yet implemented.');
510510
}
511511

512-
export function unmountFundamentalComponent(fundamentalInstance) {
512+
export function unmountFundamentalComponent(fundamentalInstance: any) {
513513
throw new Error('Not yet implemented.');
514514
}
515515

516-
export function getInstanceFromNode(node) {
516+
export function getInstanceFromNode(node: any) {
517517
throw new Error('Not yet implemented.');
518518
}
519519

520-
export function beforeRemoveInstance(instance) {
520+
export function beforeRemoveInstance(instance: any) {
521521
// noop
522522
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,9 @@ export function DEPRECATED_unmountResponderInstance(
316316
// noop
317317
}
318318

319-
export function getFundamentalComponentInstance(fundamentalInstance): Instance {
319+
export function getFundamentalComponentInstance(
320+
fundamentalInstance: ReactFundamentalComponentInstance<any, any>,
321+
): Instance {
320322
const {impl, props, state} = fundamentalInstance;
321323
return impl.getInstance(null, props, state);
322324
}
@@ -370,6 +372,6 @@ export function getInstanceFromNode(mockNode: Object) {
370372
return null;
371373
}
372374

373-
export function beforeRemoveInstance(instance) {
375+
export function beforeRemoveInstance(instance: any) {
374376
// noop
375377
}

packages/react/src/ReactHooks.js

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ import {REACT_RESPONDER_TYPE} from 'shared/ReactSymbols';
1717

1818
import ReactCurrentDispatcher from './ReactCurrentDispatcher';
1919

20+
type BasicStateAction<S> = (S => S) | S;
21+
type Dispatch<A> = A => void;
22+
2023
function resolveDispatcher() {
2124
const dispatcher = ReactCurrentDispatcher.current;
2225
invariant(
@@ -72,7 +75,9 @@ export function useContext<T>(
7275
return dispatcher.useContext(Context, unstable_observedBits);
7376
}
7477

75-
export function useState<S>(initialState: (() => S) | S) {
78+
export function useState<S>(
79+
initialState: (() => S) | S,
80+
): [S, Dispatch<BasicStateAction<S>>] {
7681
const dispatcher = resolveDispatcher();
7782
return dispatcher.useState(initialState);
7883
}
@@ -81,7 +86,7 @@ export function useReducer<S, I, A>(
8186
reducer: (S, A) => S,
8287
initialArg: I,
8388
init?: I => S,
84-
) {
89+
): [S, Dispatch<A>] {
8590
const dispatcher = resolveDispatcher();
8691
return dispatcher.useReducer(reducer, initialArg, init);
8792
}
@@ -93,46 +98,49 @@ export function useRef<T>(initialValue: T): {|current: T|} {
9398

9499
export function useEffect(
95100
create: () => (() => void) | void,
96-
inputs: Array<mixed> | void | null,
97-
) {
101+
deps: Array<mixed> | void | null,
102+
): void {
98103
const dispatcher = resolveDispatcher();
99-
return dispatcher.useEffect(create, inputs);
104+
return dispatcher.useEffect(create, deps);
100105
}
101106

102107
export function useLayoutEffect(
103108
create: () => (() => void) | void,
104-
inputs: Array<mixed> | void | null,
105-
) {
109+
deps: Array<mixed> | void | null,
110+
): void {
106111
const dispatcher = resolveDispatcher();
107-
return dispatcher.useLayoutEffect(create, inputs);
112+
return dispatcher.useLayoutEffect(create, deps);
108113
}
109114

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 {
114119
const dispatcher = resolveDispatcher();
115-
return dispatcher.useCallback(callback, inputs);
120+
return dispatcher.useCallback(callback, deps);
116121
}
117122

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 {
122127
const dispatcher = resolveDispatcher();
123-
return dispatcher.useMemo(create, inputs);
128+
return dispatcher.useMemo(create, deps);
124129
}
125130

126131
export function useImperativeHandle<T>(
127132
ref: {|current: T | null|} | ((inst: T | null) => mixed) | null | void,
128133
create: () => T,
129-
inputs: Array<mixed> | void | null,
134+
deps: Array<mixed> | void | null,
130135
): void {
131136
const dispatcher = resolveDispatcher();
132-
return dispatcher.useImperativeHandle(ref, create, inputs);
137+
return dispatcher.useImperativeHandle(ref, create, deps);
133138
}
134139

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 {
136144
if (__DEV__) {
137145
const dispatcher = resolveDispatcher();
138146
return dispatcher.useDebugValue(value, formatterFn);

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.84.0
53+
^0.89.0

scripts/flow/environment.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ declare var __REACT_DEVTOOLS_GLOBAL_HOOK__: any; /*?{
1717
inject: ?((stuff: Object) => void)
1818
};*/
1919

20+
declare module 'create-react-class' {
21+
declare var exports: React$CreateClass;
22+
}
23+
2024
declare var trustedTypes: {|
2125
isHTML: (value: any) => boolean,
2226
isScript: (value: any) => boolean,

yarn.lock

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

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==
57325732

57335733
57345734
version "0.13.0"

0 commit comments

Comments
 (0)