Update Flow to 0.84 (#17805)
* Update Flow to 0.84 * Fix violations * Use inexact object syntax in files from fbsource * Fix warning extraction to use a modern parser * Codemod inexact objects to new syntax * Tighten types that can be exact * Revert unintentional formatting changes from codemod
Dan Abramov committed
Jan 9, 2020 at 14:50 UTC
e706721490e50d0bd6af2cd933dbf857fd8b61ed
97 files changed
+313
-233
package.json
+2
-2
@@ -8,6 +8,7 @@
8
"@babel/code-frame": "^7.0.0",
9
"@babel/core": "^7.0.0",
10
"@babel/helper-module-imports": "^7.0.0",
11
+ "@babel/parser": "^7.0.0",
12
"@babel/plugin-external-helpers": "^7.0.0",
13
"@babel/plugin-proposal-class-properties": "^7.0.0",
14
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
@@ -36,7 +37,6 @@
37
"art": "^0.10.1",
38
"babel-eslint": "^10.0.0",
39
"babel-plugin-syntax-trailing-function-commas": "^6.5.0",
39
- "babylon": "6.18.0",
40
"chalk": "^1.1.3",
41
"cli-table": "^0.3.1",
42
"coffee-script": "^1.8.0",
@@ -56,7 +56,7 @@
56
"eslint-plugin-react-internal": "link:./scripts/eslint-rules",
57
"fbjs-scripts": "^0.8.3",
58
"filesize": "^3.5.6",
59
- "flow-bin": "^0.72.0",
59
+ "flow-bin": "^0.84.0",
60
"glob": "^6.0.4",
61
"glob-stream": "^6.1.0",
62
"google-closure-compiler": "20190301.0.0",
packages/create-subscription/src/createSubscription.js
+6
-6
@@ -29,10 +29,10 @@ export function createSubscription<Property, Value>(
29
callback: (value: Value | void) => void,
30
) => Unsubscribe,
31
|}>,
32
-): React$ComponentType<{
32
+): React$ComponentType<{|
33
children: (value: Value | void) => React$Node,
34
source: Property,
35
-}> {
35
+|}> {
36
const {getCurrentValue, subscribe} = config;
37
38
if (__DEV__) {
@@ -44,14 +44,14 @@ export function createSubscription<Property, Value>(
44
}
45
}
46
47
- type Props = {
47
+ type Props = {|
48
children: (value: Value) => React$Element<any>,
49
source: Property,
50
- };
51
- type State = {
50
+ |};
51
+ type State = {|
52
source: Property,
53
value: Value | void,
54
- };
54
+ |};
55
56
// Reference: https://gist.github.com/bvaughn/d569177d70b50b58bff69c3c4a5353f3
57
class Subscription extends React.Component<Props, State> {
packages/legacy-events/EventPluginRegistry.js
+1
-1
@@ -16,7 +16,7 @@ import type {
16
17
import invariant from 'shared/invariant';
18
19
-type NamesToPlugins = {[key: PluginName]: PluginModule<AnyNativeEvent>};
19
+type NamesToPlugins = {[key: PluginName]: PluginModule<AnyNativeEvent>, ...};
20
type EventPluginOrder = null | Array<PluginName>;
21
22
/**
packages/legacy-events/PluginModuleType.js
+2
-1
@@ -15,7 +15,7 @@ import type {
15
import type {TopLevelType} from './TopLevelEventTypes';
16
import type {EventSystemFlags} from 'legacy-events/EventSystemFlags';
17
18
-export type EventTypes = {[key: string]: DispatchConfig};
18
+export type EventTypes = {[key: string]: DispatchConfig, ...};
19
20
export type AnyNativeEvent = Event | KeyboardEvent | MouseEvent | Touch;
21
@@ -31,4 +31,5 @@ export type PluginModule<NativeEvent> = {
31
eventSystemFlags: EventSystemFlags,
32
) => ?ReactSyntheticEvent,
33
tapMoveThreshold?: number,
34
+ ...
35
};
packages/legacy-events/ReactSyntheticEventType.js
+6
-6
@@ -12,17 +12,17 @@ import type {Fiber} from 'react-reconciler/src/ReactFiber';
12
import type {EventPriority} from 'shared/ReactTypes';
13
import type {TopLevelType} from './TopLevelEventTypes';
14
15
-export type DispatchConfig = {
15
+export type DispatchConfig = {|
16
dependencies: Array<TopLevelType>,
17
- phasedRegistrationNames?: {
17
+ phasedRegistrationNames?: {|
18
bubbled: string,
19
captured: string,
20
- },
20
+ |},
21
registrationName?: string,
22
eventPriority: EventPriority,
23
-};
23
+|};
24
25
-export type ReactSyntheticEvent = {
25
+export type ReactSyntheticEvent = {|
26
dispatchConfig: DispatchConfig,
27
getPooled: (
28
dispatchConfig: DispatchConfig,
@@ -31,4 +31,4 @@ export type ReactSyntheticEvent = {
31
nativeEventTarget: EventTarget,
32
) => ReactSyntheticEvent,
33
isPersistent: () => boolean,
34
-} & SyntheticEvent<>;
34
+|} & SyntheticEvent<>;
packages/legacy-events/ResponderTouchHistoryStore.js
+4
-2
@@ -16,7 +16,7 @@ import {isStartish, isMoveish, isEndish} from './ResponderTopLevelEventTypes';
16
* should typically only see IDs in the range of 1-20 because IDs get recycled
17
* when touches end and start again.
18
*/
19
-type TouchRecord = {
19
+type TouchRecord = {|
20
touchActive: boolean,
21
startPageX: number,
22
startPageY: number,
@@ -27,7 +27,7 @@ type TouchRecord = {
27
previousPageX: number,
28
previousPageY: number,
29
previousTimeStamp: number,
30
-};
30
+|};
31
32
const MAX_TOUCH_BANK = 20;
33
const touchBank: Array<TouchRecord> = [];
@@ -46,10 +46,12 @@ type Touch = {
46
pageX: number,
47
pageY: number,
48
timestamp: number,
49
+ ...
50
};
51
type TouchEvent = {
52
changedTouches: Array<Touch>,
53
touches: Array<Touch>,
54
+ ...
55
};
56
57
function timestampForTouch(touch: Touch): number {
packages/react-cache/src/ReactCache.js
+3
-3
@@ -13,11 +13,10 @@ import {createLRU} from './LRU';
13
14
type Thenable<T> = {
15
then(resolve: (T) => mixed, reject: (mixed) => mixed): mixed,
16
+ ...
17
};
18
18
-type Suspender = {
19
- then(resolve: () => mixed, reject: () => mixed): mixed,
20
-};
19
+type Suspender = {then(resolve: () => mixed, reject: () => mixed): mixed, ...};
20
21
type PendingResult = {|
22
status: 0,
@@ -39,6 +38,7 @@ type Result<V> = PendingResult | ResolvedResult<V> | RejectedResult;
38
type Resource<I, V> = {
39
read(I): V,
40
preload(I): void,
41
+ ...
42
};
43
44
const Pending = 0;
packages/react-debug-tools/src/ReactDebugHooks.js
+4
-2
@@ -36,6 +36,7 @@ type HookLogEntry = {
36
primitive: string,
37
stackError: Error,
38
value: mixed,
39
+ ...
40
};
41
42
let hookLog: Array<HookLogEntry> = [];
@@ -142,7 +143,7 @@ function useReducer<S, I, A>(
143
return [state, (action: A) => {}];
144
}
145
145
-function useRef<T>(initialValue: T): {current: T} {
146
+function useRef<T>(initialValue: T): {|current: T|} {
147
let hook = nextHook();
148
let ref = hook !== null ? hook.memoizedState : {current: initialValue};
149
hookLog.push({
@@ -174,7 +175,7 @@ function useEffect(
175
}
176
177
function useImperativeHandle<T>(
177
- ref: {current: T | null} | ((inst: T | null) => mixed) | null | void,
178
+ ref: {|current: T | null|} | ((inst: T | null) => mixed) | null | void,
179
create: () => T,
180
inputs: Array<mixed> | void | null,
181
): void {
@@ -285,6 +286,7 @@ export type HooksNode = {
286
name: string,
287
value: mixed,
288
subHooks: Array<HooksNode>,
289
+ ...
290
};
291
export type HooksTree = Array<HooksNode>;
292
packages/react-devtools-core/src/backend.js
+2
-1
@@ -27,6 +27,7 @@ type ConnectOptions = {
27
resolveRNStyle?: ResolveNativeStyle,
28
isAppActive?: () => boolean,
29
websocket?: ?WebSocket,
30
+ ...
31
};
32
33
installHook(window);
@@ -120,7 +121,7 @@ export function connectToDevTools(options: ?ConnectOptions) {
121
});
122
bridge.addListener(
123
'inspectElement',
123
- ({id, rendererID}: {id: number, rendererID: number}) => {
124
+ ({id, rendererID}: {id: number, rendererID: number, ...}) => {
125
const renderer = agent.rendererInterfaces[rendererID];
126
if (renderer != null) {
127
// Send event for RN to highlight.
packages/react-devtools-shared/src/backend/agent.js
+2
-2
@@ -109,7 +109,7 @@ export default class Agent extends EventEmitter<{|
109
_bridge: BackendBridge;
110
_isProfiling: boolean = false;
111
_recordChangeDescriptions: boolean = false;
112
- _rendererInterfaces: {[key: RendererID]: RendererInterface} = {};
112
+ _rendererInterfaces: {[key: RendererID]: RendererInterface, ...} = {};
113
_persistedSelection: PersistedSelection | null = null;
114
_persistedSelectionMatch: PathMatch | null = null;
115
_traceUpdatesEnabled: boolean = false;
@@ -185,7 +185,7 @@ export default class Agent extends EventEmitter<{|
185
setupTraceUpdates(this);
186
}
187
188
- get rendererInterfaces(): {[key: RendererID]: RendererInterface} {
188
+ get rendererInterfaces(): {[key: RendererID]: RendererInterface, ...} {
189
return this._rendererInterfaces;
190
}
191
packages/react-devtools-shared/src/backend/index.js
+2
-1
@@ -30,6 +30,7 @@ export function initBackend(
30
id: number,
31
renderer: ReactRenderer,
32
rendererInterface: RendererInterface,
33
+ ...
34
}) => {
35
agent.setRendererInterface(id, rendererInterface);
36
@@ -91,7 +92,7 @@ export function initBackend(
92
subs.push(
93
hook.sub(
94
'renderer',
94
- ({id, renderer}: {id: number, renderer: ReactRenderer}) => {
95
+ ({id, renderer}: {id: number, renderer: ReactRenderer, ...}) => {
96
attachRenderer(id, renderer);
97
},
98
),
packages/react-devtools-shared/src/backend/legacy/utils.js
+1
-1
@@ -19,7 +19,7 @@ export function decorate(object: Object, attr: string, fn: Function): Function {
19
20
export function decorateMany(
21
source: Object,
22
- fns: {[attr: string]: Function},
22
+ fns: {[attr: string]: Function, ...},
23
): Object {
24
const olds = {};
25
for (const name in fns) {
packages/react-devtools-shared/src/backend/renderer.js
+2
-2
@@ -76,7 +76,7 @@ import type {
76
type getDisplayNameForFiberType = (fiber: Fiber) => string | null;
77
type getTypeSymbolType = (type: any) => Symbol | number;
78
79
-type ReactSymbolsType = {
79
+type ReactSymbolsType = {|
80
CONCURRENT_MODE_NUMBER: number,
81
CONCURRENT_MODE_SYMBOL_STRING: string,
82
DEPRECATED_ASYNC_MODE_SYMBOL_STRING: string,
@@ -94,7 +94,7 @@ type ReactSymbolsType = {
94
STRICT_MODE_SYMBOL_STRING: string,
95
SCOPE_NUMBER: number,
96
SCOPE_SYMBOL_STRING: string,
97
-};
97
+|};
98
99
type ReactPriorityLevelsType = {|
100
ImmediatePriority: number,
packages/react-devtools-shared/src/backend/types.js
+5
-8
@@ -48,13 +48,13 @@ export type FindNativeNodesForFiberID = (id: number) => ?Array<NativeType>;
48
export type ReactProviderType<T> = {
49
$$typeof: Symbol | number,
50
_context: ReactContext<T>,
51
+ ...
52
};
53
54
export type ReactRenderer = {
55
findFiberByHostInstance: (hostInstance: NativeType) => ?Fiber,
56
version: string,
57
bundleType: BundleType,
57
-
58
// 16.9+
59
overrideHookState?: ?(
60
fiber: Object,
@@ -62,30 +62,25 @@ export type ReactRenderer = {
62
path: Array<string | number>,
63
value: any,
64
) => void,
65
-
65
// 16.7+
66
overrideProps?: ?(
67
fiber: Object,
68
path: Array<string | number>,
69
value: any,
70
) => void,
72
-
71
// 16.9+
72
scheduleUpdate?: ?(fiber: Object) => void,
73
setSuspenseHandler?: ?(shouldSuspend: (fiber: Object) => boolean) => void,
76
-
74
// Only injected by React v16.8+ in order to support hooks inspection.
75
currentDispatcherRef?: {|current: null | Dispatcher|},
79
-
76
// Only injected by React v16.9+ in DEV mode.
77
// Enables DevTools to append owners-only component stack to error messages.
78
getCurrentFiber?: () => Fiber | null,
83
-
79
// Uniquely identifies React DOM v15.
80
ComponentTree?: any,
86
-
81
// Present for React DOM v12 (possibly earlier) through v15.
82
Mount?: any,
83
+ ...
84
};
85
86
export type ChangeDescription = {|
@@ -267,12 +262,13 @@ export type RendererInterface = {
262
count: number,
263
) => void,
264
updateComponentFilters: (componentFilters: Array<ComponentFilter>) => void,
265
+ ...
266
};
267
268
export type Handler = (data: any) => void;
269
270
export type DevToolsHook = {
275
- listeners: {[key: string]: Array<Handler>},
271
+ listeners: {[key: string]: Array<Handler>, ...},
272
rendererInterfaces: Map<RendererID, RendererInterface>,
273
renderers: Map<RendererID, ReactRenderer>,
274
@@ -299,4 +295,5 @@ export type DevToolsHook = {
295
// Added in v16.9 to support Fast Refresh
296
didError?: boolean,
297
) => void,
298
+ ...
299
};
packages/react-devtools-shared/src/backend/views/Highlighter/index.js
+1
@@ -95,6 +95,7 @@ export default function setupHighlighter(
95
openNativeElementsPanel: boolean,
96
rendererID: number,
97
scrollIntoView: boolean,
98
+ ...
99
}) {
100
const renderer = agent.rendererInterfaces[rendererID];
101
if (renderer == null) {
packages/react-devtools-shared/src/backend/views/utils.js
+1
@@ -14,6 +14,7 @@ export type Rect = {
14
right: number,
15
top: number,
16
width: number,
17
+ ...
18
};
19
20
// Get the window object for the document that a node belongs to,
packages/react-devtools-shared/src/devtools/cache.js
+4
-6
@@ -21,11 +21,10 @@ import React, {createContext} from 'react';
21
22
export type Thenable<T> = {
23
then(resolve: (T) => mixed, reject: (mixed) => mixed): mixed,
24
+ ...
25
};
26
26
-type Suspender = {
27
- then(resolve: () => mixed, reject: () => mixed): mixed,
28
-};
27
+type Suspender = {then(resolve: () => mixed, reject: () => mixed): mixed, ...};
28
29
type PendingResult = {|
30
status: 0,
@@ -50,6 +49,7 @@ export type Resource<Input, Key, Value> = {
49
read(Input): Value,
50
preload(Input): void,
51
write(Key, Value): void,
52
+ ...
53
};
54
55
const Pending = 0;
@@ -73,9 +73,7 @@ function readContext(Context, observedBits) {
73
74
const CacheContext = createContext(null);
75
76
-type Config = {
77
- useWeakMap?: boolean,
78
-};
76
+type Config = {useWeakMap?: boolean, ...};
77
78
const entries: Map<
79
Resource<any, any, any>,
packages/react-devtools-shared/src/devtools/views/Button.js
+1
@@ -17,6 +17,7 @@ type Props = {
17
children: React$Node,
18
className?: string,
19
title?: string,
20
+ ...
21
};
22
23
export default function Button({
packages/react-devtools-shared/src/devtools/views/Components/Element.js
+1
@@ -24,6 +24,7 @@ type Props = {
24
data: ItemData,
25
index: number,
26
style: Object,
27
+ ...
28
};
29
30
export default function ElementView({data, index, style}: Props) {
packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.js
+1
@@ -15,6 +15,7 @@ type Props = {
15
onFocus?: (event: FocusEvent) => void,
16
placeholder?: string,
17
value: any,
18
+ ...
19
};
20
21
export default function AutoSizeInput({
packages/react-devtools-shared/src/devtools/views/Components/OwnersStack.js
+2
@@ -199,6 +199,7 @@ type ElementsDropdownProps = {
199
owners: Array<Owner>,
200
selectedIndex: number,
201
selectOwner: SelectOwner,
202
+ ...
203
};
204
function ElementsDropdown({
205
owners,
@@ -245,6 +246,7 @@ type ElementViewProps = {
246
isSelected: boolean,
247
owner: Owner,
248
selectOwner: SelectOwner,
249
+ ...
250
};
251
function ElementView({isSelected, owner, selectOwner}: ElementViewProps) {
252
const store = useContext(StoreContext);
packages/react-devtools-shared/src/devtools/views/Components/Tree.js
+1
-1
@@ -38,7 +38,7 @@ const DEFAULT_INDENTATION_SIZE = 12;
38
export type ItemData = {|
39
numElements: number,
40
isNavigatingWithKeyboard: boolean,
41
- lastScrolledIDRef: {current: number | null},
41
+ lastScrolledIDRef: {current: number | null, ...},
42
onElementMouseEnter: (id: number) => void,
43
treeFocused: boolean,
44
|};
packages/react-devtools-shared/src/devtools/views/Components/types.js
+1
-1
@@ -99,6 +99,6 @@ export type DehydratedData = {|
99
| Unserializable
100
| Array<Dehydrated>
101
| Array<Unserializable>
102
- | {[key: string]: string | Dehydrated | Unserializable},
102
+ | {[key: string]: string | Dehydrated | Unserializable, ...},
103
unserializable: Array<Array<string | number>>,
104
|};
packages/react-devtools-shared/src/devtools/views/Profiler/CommitFlamegraphListItem.js
+1
@@ -20,6 +20,7 @@ type Props = {
20
data: ItemData,
21
index: number,
22
style: Object,
23
+ ...
24
};
25
26
function CommitFlamegraphListItem({data, index, style}: Props) {
packages/react-devtools-shared/src/devtools/views/Profiler/CommitRankedListItem.js
+1
@@ -20,6 +20,7 @@ type Props = {
20
data: ItemData,
21
index: number,
22
style: Object,
23
+ ...
24
};
25
26
function CommitRankedListItem({data, index, style}: Props) {
packages/react-devtools-shared/src/devtools/views/Profiler/InteractionListItem.js
+1
@@ -19,6 +19,7 @@ type Props = {
19
data: ItemData,
20
index: number,
21
style: Object,
22
+ ...
23
};
24
25
function InteractionListItem({data: itemData, index, style}: Props) {
packages/react-devtools-shared/src/devtools/views/Profiler/SnapshotCommitListItem.js
+1
@@ -19,6 +19,7 @@ type Props = {
19
data: ItemData,
20
index: number,
21
style: Object,
22
+ ...
23
};
24
25
function SnapshotCommitListItem({data: itemData, index, style}: Props) {
packages/react-devtools-shared/src/devtools/views/Settings/SettingsModalContext.js
+1
@@ -15,6 +15,7 @@ export type Theme = 'auto' | 'light' | 'dark';
15
type Context = {
16
isModalShowing: boolean,
17
setIsModalShowing: (value: boolean) => void,
18
+ ...
19
};
20
21
const SettingsModalContext = createContext<Context>(((null: any): Context));
packages/react-devtools-shared/src/devtools/views/Toggle.js
+1
@@ -20,6 +20,7 @@ type Props = {
20
isDisabled?: boolean,
21
onChange: (isChecked: boolean) => void,
22
title?: string,
23
+ ...
24
};
25
26
export default function Toggle({
packages/react-devtools-shared/src/devtools/views/hooks.js
+2
-2
@@ -106,7 +106,7 @@ export function useEditableValue(
106
}
107
108
export function useIsOverflowing(
109
- containerRef: {current: HTMLDivElement | null},
109
+ containerRef: {current: HTMLDivElement | null, ...},
110
totalChildWidth: number,
111
): boolean {
112
const [isOverflowing, setIsOverflowing] = useState<boolean>(false);
@@ -195,7 +195,7 @@ export function useLocalStorage<T>(
195
}
196
197
export function useModalDismissSignal(
198
- modalRef: {current: HTMLDivElement | null},
198
+ modalRef: {current: HTMLDivElement | null, ...},
199
dismissCallback: () => void,
200
dismissOnClickOutside?: boolean = true,
201
): void {
packages/react-devtools-shared/src/devtools/views/portaledContent.js
+1
-3
@@ -11,9 +11,7 @@ import React from 'react';
11
import {createPortal} from 'react-dom';
12
import ErrorBoundary from './ErrorBoundary';
13
14
-export type Props = {
15
- portalContainer?: Element,
16
-};
14
+export type Props = {portalContainer?: Element, ...};
15
16
export default function portaledContent(
17
Component: React$StatelessFunctionalComponent<any>,
packages/react-devtools-shared/src/hydration.js
+3
-2
@@ -52,6 +52,7 @@ export type Unserializable = {
52
size?: number,
53
type: string,
54
unserializable: boolean,
55
+ ...
56
};
57
58
// This threshold determines the depth at which the bridge "dehydrates" nested data.
@@ -129,7 +130,7 @@ export function dehydrate(
130
| Unserializable
131
| Array<Dehydrated>
132
| Array<Unserializable>
132
- | {[key: string]: string | Dehydrated | Unserializable} {
133
+ | {[key: string]: string | Dehydrated | Unserializable, ...} {
134
const type = getDataType(data);
135
136
let isPathWhitelistedCheck;
@@ -375,7 +376,7 @@ export function hydrate(
376
parent[last] = undefined;
377
} else {
378
// Replace the string keys with Symbols so they're non-enumerable.
378
- const replaced: {[key: Symbol]: boolean | string} = {};
379
+ const replaced: {[key: Symbol]: boolean | string, ...} = {};
380
replaced[meta.inspectable] = !!value.inspectable;
381
replaced[meta.inspected] = false;
382
replaced[meta.name] = value.name;
packages/react-dom/src/client/ReactDOM.js
+2
-6
@@ -106,12 +106,8 @@ setBatchingImplementation(
106
);
107
108
export type DOMContainer =
109
- | (Element & {
110
- _reactRootContainer: ?RootType,
111
- })
112
- | (Document & {
113
- _reactRootContainer: ?RootType,
114
- });
109
+ | (Element & {_reactRootContainer: ?RootType, ...})
110
+ | (Document & {_reactRootContainer: ?RootType, ...});
111
112
function createPortal(
113
children: ReactNodeList,
packages/react-dom/src/client/ReactDOMHostConfig.js
+7
-4
@@ -65,13 +65,12 @@ export type Props = {
65
hidden?: boolean,
66
suppressHydrationWarning?: boolean,
67
dangerouslySetInnerHTML?: mixed,
68
- style?: {
69
- display?: string,
70
- },
68
+ style?: {display?: string, ...},
69
bottom?: null | number,
70
left?: null | number,
71
right?: null | number,
72
top?: null | number,
73
+ ...
74
};
75
export type EventTargetChildElement = {
76
type: string,
@@ -83,18 +82,22 @@ export type EventTargetChildElement = {
82
left?: string,
83
right?: string,
84
top?: string,
85
+ ...
86
},
87
+ ...
88
},
89
+ ...
90
};
91
export type Container = Element | Document;
92
export type Instance = Element;
93
export type TextInstance = Text;
92
-export type SuspenseInstance = Comment & {_reactRetry?: () => void};
94
+export type SuspenseInstance = Comment & {_reactRetry?: () => void, ...};
95
export type HydratableInstance = Instance | TextInstance | SuspenseInstance;
96
export type PublicInstance = Element | Text;
97
type HostContextDev = {
98
namespace: string,
99
ancestorInfo: mixed,
100
+ ...
101
};
102
type HostContextProd = string;
103
export type HostContext = HostContextDev | HostContextProd;
packages/react-dom/src/client/ReactDOMInput.js
+5
-3
@@ -25,7 +25,9 @@ type InputWithWrapperState = HTMLInputElement & {
25
initialValue: ToStringValue,
26
initialChecked: ?boolean,
27
controlled?: boolean,
28
+ ...
29
},
30
+ ...
31
};
32
33
let didWarnValueDefaultValue = false;
@@ -178,10 +180,10 @@ export function updateWrapper(element: Element, props: Object) {
180
// eslint-disable-next-line
181
node.value != (value: any)
182
) {
181
- node.value = toString(value);
183
+ node.value = toString((value: any));
184
}
183
- } else if (node.value !== toString(value)) {
184
- node.value = toString(value);
185
+ } else if (node.value !== toString((value: any))) {
186
+ node.value = toString((value: any));
187
}
188
} else if (type === 'submit' || type === 'reset') {
189
// Submit/reset inputs need the attribute removed completely to avoid
packages/react-dom/src/client/ReactDOMRoot.js
+3
-1
@@ -17,8 +17,8 @@ import type {FiberRoot} from 'react-reconciler/src/ReactFiberRoot';
17
export type RootType = {
18
render(children: ReactNodeList, callback: ?() => mixed): void,
19
unmount(callback: ?() => mixed): void,
20
-
20
_internalRoot: FiberRoot,
21
+ ...
22
};
23
24
export type RootOptions = {
@@ -26,7 +26,9 @@ export type RootOptions = {
26
hydrationOptions?: {
27
onHydrated?: (suspenseNode: Comment) => void,
28
onDeleted?: (suspenseNode: Comment) => void,
29
+ ...
30
},
31
+ ...
32
};
33
34
import {
packages/react-dom/src/client/ReactDOMSelect.js
+4
-5
@@ -19,11 +19,9 @@ if (__DEV__) {
19
didWarnValueDefaultValue = false;
20
}
21
22
-type SelectWithWrapperState = HTMLSelectElement & {
23
- _wrapperState: {
24
- wasMultiple: boolean,
25
- },
26
-};
22
+type SelectWithWrapperState = HTMLSelectElement & {|
23
+ _wrapperState: {|wasMultiple: boolean|},
24
+|};
25
26
function getDeclarationErrorAddendum() {
27
const ownerName = getCurrentFiberOwnerNameInDevOrNull();
@@ -75,6 +73,7 @@ function updateOptions(
73
) {
74
type IndexableHTMLOptionsCollection = HTMLOptionsCollection & {
75
[key: number]: HTMLOptionElement,
76
+ ...,
77
};
78
const options: IndexableHTMLOptionsCollection = node.options;
79
packages/react-dom/src/client/ReactDOMTextarea.js
+3
-5
@@ -16,11 +16,9 @@ import type {ToStringValue} from './ToStringValue';
16
17
let didWarnValDefaultVal = false;
18
19
-type TextAreaWithWrapperState = HTMLTextAreaElement & {
20
- _wrapperState: {
21
- initialValue: ToStringValue,
22
- },
23
-};
19
+type TextAreaWithWrapperState = HTMLTextAreaElement & {|
20
+ _wrapperState: {|initialValue: ToStringValue|},
21
+|};
22
23
/**
24
* Implements a <textarea> host component that allows setting `value`, and
packages/react-dom/src/client/inputValueTracking.js
+3
-3
@@ -7,12 +7,12 @@
7
* @flow
8
*/
9
10
-type ValueTracker = {
10
+type ValueTracker = {|
11
getValue(): string,
12
setValue(value: string): void,
13
stopTracking(): void,
14
-};
15
-type WrapperState = {_valueTracker?: ?ValueTracker};
14
+|};
15
+type WrapperState = {_valueTracker?: ?ValueTracker, ...};
16
type ElementWithValueTracker = HTMLInputElement & WrapperState;
17
18
function isCheckable(elem: HTMLInputElement) {
packages/react-dom/src/client/setInnerHTML.js
+1
-1
@@ -23,7 +23,7 @@ let reusableSVGContainer;
23
*/
24
const setInnerHTML = createMicrosoftUnsafeLocalFunction(function(
25
node: Element,
26
- html: {valueOf(): {toString(): string}},
26
+ html: {valueOf(): {toString(): string, ...}, ...},
27
): void {
28
if (node.namespaceURI === Namespaces.svg) {
29
if (__DEV__) {
packages/react-dom/src/events/ReactBrowserEventEmitter.js
+2
@@ -86,7 +86,9 @@ import isEventSupported from './isEventSupported';
86
*/
87
88
const PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
89
+// prettier-ignore
90
const elementListenerMap:
91
+ // $FlowFixMe Work around Flow bug
92
| WeakMap
93
| Map<
94
Document | Element | Node,
packages/react-dom/src/events/ReactDOMEventReplaying.js
+1
@@ -74,6 +74,7 @@ export function setAttemptHydrationAtCurrentPriority(
74
type PointerEvent = Event & {
75
pointerId: number,
76
relatedTarget: EventTarget | null,
77
+ ...
78
};
79
80
import {
packages/react-dom/src/server/ReactPartialRenderer.js
+6
-4
@@ -701,11 +701,10 @@ type Frame = {
701
childIndex: number,
702
context: Object,
703
footer: string,
704
+ ...
705
};
706
706
-type FrameDev = Frame & {
707
- debugElementStack: Array<ReactElement>,
708
-};
707
+type FrameDev = Frame & {|debugElementStack: Array<ReactElement>|};
708
709
class ReactDOMServerRenderer {
710
threadID: ThreadID;
@@ -1578,7 +1577,10 @@ class ReactDOMServerRenderer {
1577
const innerMarkup = getNonChildrenInnerMarkup(props);
1578
if (innerMarkup != null) {
1579
children = [];
1581
- if (newlineEatingTags[tag] && innerMarkup.charAt(0) === '\n') {
1580
+ if (
1581
+ newlineEatingTags.hasOwnProperty(tag) &&
1582
+ innerMarkup.charAt(0) === '\n'
1583
+ ) {
1584
// text/html ignores the first character in these tags if it's a newline
1585
// Prefer to break application/xml over text/html (for now) by adding
1586
// a newline specifically to get eaten by the parser. (Alternately for
packages/react-dom/src/server/ReactPartialRendererHooks.js
+7
-7
@@ -25,21 +25,21 @@ import is from 'shared/objectIs';
25
type BasicStateAction<S> = (S => S) | S;
26
type Dispatch<A> = A => void;
27
28
-type Update<A> = {
28
+type Update<A> = {|
29
action: A,
30
next: Update<A> | null,
31
-};
31
+|};
32
33
-type UpdateQueue<A> = {
33
+type UpdateQueue<A> = {|
34
last: Update<A> | null,
35
dispatch: any,
36
-};
36
+|};
37
38
-type Hook = {
38
+type Hook = {|
39
memoizedState: any,
40
queue: UpdateQueue<any> | null,
41
next: Hook | null,
42
-};
42
+|};
43
44
let currentlyRenderingComponent: Object | null = null;
45
let firstWorkInProgressHook: Hook | null = null;
@@ -369,7 +369,7 @@ function useMemo<T>(nextCreate: () => T, deps: Array<mixed> | void | null): T {
369
return nextValue;
370
}
371
372
-function useRef<T>(initialValue: T): {current: T} {
372
+function useRef<T>(initialValue: T): {|current: T|} {
373
currentlyRenderingComponent = resolveCurrentlyRenderingComponent();
374
workInProgressHook = createWorkInProgressHook();
375
const previousRef = workInProgressHook.memoizedState;
packages/react-dom/src/shared/sanitizeURL.js
+1
-1
@@ -11,7 +11,7 @@ import invariant from 'shared/invariant';
11
import ReactSharedInternals from 'shared/ReactSharedInternals';
12
import {disableJavaScriptURLs} from 'shared/ReactFeatureFlags';
13
14
-let ReactDebugCurrentFrame = ((null: any): {getStackAddendum(): string});
14
+let ReactDebugCurrentFrame = ((null: any): {getStackAddendum(): string, ...});
15
if (__DEV__) {
16
ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
17
}
packages/react-flight/src/ReactFlightClient.js
+8
-1
@@ -20,7 +20,12 @@ export type ReactModelRoot<T> = {|
20
model: T,
21
|};
22
23
-type JSONValue = number | null | boolean | string | {[key: string]: JSONValue};
23
+type JSONValue =
24
+ | number
25
+ | null
26
+ | boolean
27
+ | string
28
+ | {[key: string]: JSONValue, ...};
29
30
const PENDING = 0;
31
const RESOLVED = 1;
@@ -49,10 +54,12 @@ type OpaqueResponseWithoutDecoder = {
54
modelRoot: ReactModelRoot<any>,
55
chunks: Map<number, Chunk>,
56
fromJSON: (key: string, value: JSONValue) => any,
57
+ ...
58
};
59
60
type OpaqueResponse = OpaqueResponseWithoutDecoder & {
61
stringDecoder: StringDecoder,
62
+ ...
63
};
64
65
export function createResponse(source: Source): OpaqueResponse {
packages/react-interactions/accessibility/src/FocusGroup.js
+1
@@ -17,6 +17,7 @@ import setElementCanTab from './shared/setElementCanTab';
17
type FocusItemProps = {
18
children?: React.Node,
19
onKeyDown?: KeyboardEvent => void,
20
+ ...
21
};
22
23
type FocusGroupProps = {|
packages/react-interactions/accessibility/src/FocusTable.js
+2
-3
@@ -18,11 +18,10 @@ type FocusCellProps = {
18
children?: React.Node,
19
onKeyDown?: KeyboardEvent => void,
20
colSpan?: number,
21
+ ...
22
};
23
23
-type FocusRowProps = {
24
- children: React.Node,
25
-};
24
+type FocusRowProps = {children: React.Node, ...};
25
26
type FocusTableProps = {|
27
children: React.Node,
packages/react-interactions/events/src/dom/ContextMenu.js
+1
-3
@@ -23,9 +23,7 @@ type ContextMenuProps = {|
23
preventDefault: boolean,
24
|};
25
26
-type ContextMenuState = {
27
- pointerType: PointerType,
28
-};
26
+type ContextMenuState = {pointerType: PointerType, ...};
27
28
type ContextMenuEvent = {|
29
altKey: boolean,
packages/react-interactions/events/src/dom/Drag.js
+2
@@ -29,6 +29,7 @@ type DragProps = {
29
onDragMove: (e: DragEvent) => void,
30
onDragEnd: (e: DragEvent) => void,
31
onDragChange: boolean => void,
32
+ ...
33
};
34
35
type DragState = {|
@@ -57,6 +58,7 @@ if (typeof window !== 'undefined' && window.PointerEvent === undefined) {
58
type EventData = {
59
diffX: number,
60
diffY: number,
61
+ ...
62
};
63
type DragEventType = 'dragstart' | 'dragend' | 'dragchange' | 'dragmove';
64
packages/react-interactions/events/src/dom/Focus.js
+3
@@ -36,6 +36,7 @@ type FocusState = {
36
isFocused: boolean,
37
isFocusVisible: boolean,
38
pointerType: PointerType,
39
+ ...
40
};
41
42
type FocusProps = {
@@ -44,6 +45,7 @@ type FocusProps = {
45
onFocus: (e: FocusEvent) => void,
46
onFocusChange: boolean => void,
47
onFocusVisibleChange: boolean => void,
48
+ ...
49
};
50
51
type FocusEventType = 'focus' | 'blur' | 'focuschange' | 'focusvisiblechange';
@@ -55,6 +57,7 @@ type FocusWithinProps = {
57
onBlurWithin?: (e: FocusEvent) => void,
58
onFocusWithinChange?: boolean => void,
59
onFocusWithinVisibleChange?: boolean => void,
60
+ ...
61
};
62
63
type FocusWithinEventType =
packages/react-interactions/events/src/dom/Hover.js
+2
@@ -24,6 +24,7 @@ type HoverProps = {
24
onHoverEnd: (e: HoverEvent) => void,
25
onHoverMove: (e: HoverEvent) => void,
26
onHoverStart: (e: HoverEvent) => void,
27
+ ...
28
};
29
30
type HoverState = {
@@ -32,6 +33,7 @@ type HoverState = {
33
isHovered: boolean,
34
isTouched?: boolean,
35
ignoreEmulatedMouseEvents?: boolean,
36
+ ...
37
};
38
39
type HoverEventType = 'hoverstart' | 'hoverend' | 'hoverchange' | 'hovermove';
packages/react-interactions/events/src/dom/Input.js
+1
@@ -23,6 +23,7 @@ type InputResponderProps = {
23
onBeforeChange: (e: InputEvent) => void,
24
onChange: (e: InputEvent) => void,
25
onValueChange: (value: string | boolean) => void,
26
+ ...
27
};
28
29
type InputEvent = {|
packages/react-interactions/events/src/dom/PressLegacy.js
+2
@@ -27,6 +27,7 @@ type PressProps = {|
27
right: number,
28
bottom: number,
29
left: number,
30
+ ...
31
},
32
preventDefault: boolean,
33
onPress: (e: PressEvent) => void,
@@ -65,6 +66,7 @@ type PressState = {
66
activePointerId: null | number,
67
shouldPreventClick: boolean,
68
touchEvent: null | Touch,
69
+ ...
70
};
71
72
type PressEventType =
packages/react-interactions/events/src/dom/Scroll.js
+2
@@ -25,6 +25,7 @@ type ScrollProps = {
25
onScroll: ScrollEvent => void,
26
onScrollDragStart: ScrollEvent => void,
27
onScrollDragEnd: ScrollEvent => void,
28
+ ...
29
};
30
31
type ScrollState = {
@@ -35,6 +36,7 @@ type ScrollState = {
36
isTouching: boolean,
37
scrollLeft: number,
38
scrollTop: number,
39
+ ...
40
};
41
42
type ScrollEventType =
packages/react-interactions/events/src/dom/Swipe.js
+3
@@ -26,6 +26,7 @@ type SwipeProps = {
26
onSwipeEnd: (e: SwipeEvent) => void,
27
onSwipeLeft: (e: SwipeEvent) => void,
28
onSwipeRight: (e: SwipeEvent) => void,
29
+ ...
30
};
31
32
const targetEventTypes = ['pointerdown'];
@@ -47,6 +48,7 @@ if (typeof window !== 'undefined' && window.PointerEvent === undefined) {
48
type EventData = {
49
diffX: number,
50
diffY: number,
51
+ ...
52
};
53
type SwipeEventType = 'swipeleft' | 'swiperight' | 'swipeend' | 'swipemove';
54
@@ -101,6 +103,7 @@ type SwipeState = {
103
swipeTarget: null | Element | Document,
104
x: number,
105
y: number,
106
+ ...
107
};
108
109
const swipeResponderImpl = {
packages/react-native-renderer/src/ReactFabricHostConfig.js
+2
-3
@@ -59,10 +59,9 @@ export type Props = Object;
59
export type Instance = {
60
node: Node,
61
canonical: ReactFabricHostComponent,
62
+ ...
63
};
63
-export type TextInstance = {
64
- node: Node,
65
-};
64
+export type TextInstance = {node: Node, ...};
65
export type HydratableInstance = Instance | TextInstance;
66
export type PublicInstance = ReactFabricHostComponent;
67
export type Container = number;
packages/react-native-renderer/src/ReactNativeHostConfig.js
+1
@@ -35,6 +35,7 @@ export type Instance = {
35
_children: Array<Instance | number>,
36
_nativeTag: number,
37
viewConfig: ReactNativeBaseComponentViewConfig<>,
38
+ ...
39
};
40
export type TextInstance = number;
41
export type HydratableInstance = Instance | TextInstance;
packages/react-native-renderer/src/ReactNativeTypes.js
+19
-13
@@ -45,9 +45,8 @@ export type AttributeConfiguration<
45
TStyleProps = string,
46
> = $ReadOnly<{
47
[propName: TProps]: AttributeType,
48
- style: $ReadOnly<{
49
- [propName: TStyleProps]: AttributeType,
50
- }>,
48
+ style: $ReadOnly<{[propName: TStyleProps]: AttributeType, ...}>,
49
+ ...
50
}>;
51
52
export type ReactNativeBaseComponentViewConfig<
@@ -62,18 +61,16 @@ export type ReactNativeBaseComponentViewConfig<
61
bubbled: string,
62
|}>,
63
|}>,
64
+ ...,
65
}>,
66
- Commands?: $ReadOnly<{
67
- [commandName: string]: number,
68
- }>,
66
+ Commands?: $ReadOnly<{[commandName: string]: number, ...}>,
67
directEventTypes?: $ReadOnly<{
68
[eventName: string]: $ReadOnly<{|
69
registrationName: string,
70
|}>,
71
+ ...,
72
}>,
74
- NativeProps?: $ReadOnly<{
75
- [propName: string]: string,
76
- }>,
73
+ NativeProps?: $ReadOnly<{[propName: string]: string, ...}>,
74
uiViewClassName: string,
75
validAttributes: AttributeConfiguration<TProps, TStyleProps>,
76
|}>;
@@ -116,6 +113,7 @@ export type NativeMethods = {
113
onFail?: () => void,
114
): void,
115
setNativeProps(nativeProps: Object): void,
116
+ ...
117
};
118
119
export type NativeMethodsMixinType = NativeMethods;
@@ -126,10 +124,12 @@ type SecretInternalsType = {
124
computeComponentStackForErrorReporting(tag: number): string,
125
// TODO (bvaughn) Decide which additional types to expose here?
126
// And how much information to fill in for the above types.
127
+ ...
128
};
129
130
type SecretInternalsFabricType = {
131
NativeMethodsMixin: NativeMethodsMixinType,
132
+ ...
133
};
134
135
/**
@@ -137,7 +137,7 @@ type SecretInternalsFabricType = {
137
* Provide minimal Flow typing for the high-level RN API and call it a day.
138
*/
139
export type ReactNativeType = {
140
- NativeComponent: typeof ReactNativeComponent,
140
+ NativeComponent: _InternalReactNativeComponentClass<{...}>,
141
findHostInstance_DEPRECATED(
142
componentOrHandle: any,
143
): ?ElementRef<HostComponent<mixed>>,
@@ -150,13 +150,14 @@ export type ReactNativeType = {
150
): any,
151
unmountComponentAtNode(containerTag: number): any,
152
unmountComponentAtNodeAndRemoveContainer(containerTag: number): any,
153
- unstable_batchedUpdates: any, // TODO (bvaughn) Add types
154
-
153
+ // TODO (bvaughn) Add types
154
+ unstable_batchedUpdates: any,
155
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: SecretInternalsType,
156
+ ...
157
};
158
159
export type ReactFabricType = {
159
- NativeComponent: typeof ReactNativeComponent,
160
+ NativeComponent: _InternalReactNativeComponentClass<{...}>,
161
findHostInstance_DEPRECATED(componentOrHandle: any): ?HostComponent<mixed>,
162
findNodeHandle(componentOrHandle: any): ?number,
163
dispatchCommand(handle: any, command: string, args: Array<any>): void,
@@ -167,6 +168,7 @@ export type ReactFabricType = {
168
): any,
169
unmountComponentAtNode(containerTag: number): any,
170
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: SecretInternalsFabricType,
171
+ ...
172
};
173
174
export type ReactNativeEventTarget = {
@@ -176,7 +178,9 @@ export type ReactNativeEventTarget = {
178
viewConfig: ReactNativeBaseComponentViewConfig<>,
179
currentProps: Object,
180
_internalInstanceHandle: Object,
181
+ ...
182
},
183
+ ...
184
};
185
186
export type ReactFaricEventTouch = {
@@ -190,6 +194,7 @@ export type ReactFaricEventTouch = {
194
target: number,
195
timestamp: number,
196
force: number,
197
+ ...
198
};
199
200
export type ReactFaricEvent = {
@@ -197,4 +202,5 @@ export type ReactFaricEvent = {
202
changedTouches: Array<ReactFaricEventTouch>,
203
targetTouches: Array<ReactFaricEventTouch>,
204
target: number,
205
+ ...
206
};
packages/react-noop-renderer/src/createReactNoop.js
+3
-1
@@ -31,6 +31,7 @@ type Container = {
31
rootID: string,
32
children: Array<Instance | TextInstance>,
33
pendingChildren: Array<Instance | TextInstance>,
34
+ ...
35
};
36
type Props = {
37
prop: any,
@@ -40,6 +41,7 @@ type Props = {
41
left?: null | number,
42
right?: null | number,
43
top?: null | number,
44
+ ...
45
};
46
type Instance = {|
47
type: string,
@@ -315,7 +317,7 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
317
type: string,
318
oldProps: Props,
319
newProps: Props,
318
- ): null | {} {
320
+ ): null | {...} {
321
if (type === 'errorInCompletePhase') {
322
throw new Error('Error in host config.');
323
}
packages/react-reconciler/src/ReactCapturedValue.js
+4
-4
@@ -11,13 +11,13 @@ import type {Fiber} from './ReactFiber';
11
12
import {getStackByFiberInDevAndProd} from './ReactCurrentFiber';
13
14
-export type CapturedValue<T> = {
14
+export type CapturedValue<T> = {|
15
value: T,
16
source: Fiber | null,
17
stack: string | null,
18
-};
18
+|};
19
20
-export type CapturedError = {
20
+export type CapturedError = {|
21
componentName: ?string,
22
componentStack: string,
23
error: mixed,
@@ -25,7 +25,7 @@ export type CapturedError = {
25
errorBoundaryFound: boolean,
26
errorBoundaryName: string | null,
27
willRetry: boolean,
28
-};
28
+|};
29
30
export function createCapturedValue<T>(
31
value: T,
packages/react-reconciler/src/ReactFiber.js
+5
-1
@@ -120,6 +120,7 @@ export type Dependencies = {
120
ReactEventResponder<any, any>,
121
ReactEventResponderInstance<any, any>,
122
> | null,
123
+ ...
124
};
125
126
// A Fiber is work on a Component that needs to be done or was done. There can
@@ -170,7 +171,10 @@ export type Fiber = {|
171
172
// The ref last used to attach this node.
173
// I'll avoid adding an owner field for prod and model that as functions.
173
- ref: null | (((handle: mixed) => void) & {_stringRef: ?string}) | RefObject,
174
+ ref:
175
+ | null
176
+ | (((handle: mixed) => void) & {_stringRef: ?string, ...})
177
+ | RefObject,
178
179
// Input is the data coming into process this fiber. Arguments. Props.
180
pendingProps: any, // This type will be more specific once we overload the tag.
packages/react-reconciler/src/ReactFiberCommitWork.js
+6
-2
@@ -914,8 +914,11 @@ function emptyPortalContainer(current: Fiber) {
914
return;
915
}
916
917
- const portal: {containerInfo: Container, pendingChildren: ChildSet} =
918
- current.stateNode;
917
+ const portal: {
918
+ containerInfo: Container,
919
+ pendingChildren: ChildSet,
920
+ ...
921
+ } = current.stateNode;
922
const {containerInfo} = portal;
923
const emptyChildSet = createContainerChildSet(containerInfo);
924
replaceContainerChildren(containerInfo, emptyChildSet);
@@ -938,6 +941,7 @@ function commitContainer(finishedWork: Fiber) {
941
const portalOrRoot: {
942
containerInfo: Container,
943
pendingChildren: ChildSet,
944
+ ...
945
} = finishedWork.stateNode;
946
const {containerInfo, pendingChildren} = portalOrRoot;
947
replaceContainerChildren(containerInfo, pendingChildren);
packages/react-reconciler/src/ReactFiberCompleteWork.js
+1
@@ -435,6 +435,7 @@ if (supportsMutation) {
435
const portalOrRoot: {
436
containerInfo: Container,
437
pendingChildren: ChildSet,
438
+ ...
439
} = workInProgress.stateNode;
440
const childrenUnchanged = workInProgress.firstEffect === null;
441
if (childrenUnchanged) {
packages/react-reconciler/src/ReactFiberHooks.js
+28
-33
@@ -59,7 +59,7 @@ import {
59
60
const {ReactCurrentDispatcher, ReactCurrentBatchConfig} = ReactSharedInternals;
61
62
-export type Dispatcher = {
62
+export type Dispatcher = {|
63
readContext<T>(
64
context: ReactContext<T>,
65
observedBits: void | number | boolean,
@@ -74,7 +74,7 @@ export type Dispatcher = {
74
context: ReactContext<T>,
75
observedBits: void | number | boolean,
76
): T,
77
- useRef<T>(initialValue: T): {current: T},
77
+ useRef<T>(initialValue: T): {|current: T|},
78
useEffect(
79
create: () => (() => void) | void,
80
deps: Array<mixed> | void | null,
@@ -86,7 +86,7 @@ export type Dispatcher = {
86
useCallback<T>(callback: T, deps: Array<mixed> | void | null): T,
87
useMemo<T>(nextCreate: () => T, deps: Array<mixed> | void | null): T,
88
useImperativeHandle<T>(
89
- ref: {current: T | null} | ((inst: T | null) => mixed) | null | void,
89
+ ref: {|current: T | null|} | ((inst: T | null) => mixed) | null | void,
90
create: () => T,
91
deps: Array<mixed> | void | null,
92
): void,
@@ -99,25 +99,24 @@ export type Dispatcher = {
99
useTransition(
100
config: SuspenseConfig | void | null,
101
): [(() => void) => void, boolean],
102
-};
102
+|};
103
104
-type Update<S, A> = {
104
+type Update<S, A> = {|
105
expirationTime: ExpirationTime,
106
suspenseConfig: null | SuspenseConfig,
107
action: A,
108
eagerReducer: ((S, A) => S) | null,
109
eagerState: S | null,
110
next: Update<S, A>,
111
-
111
priority?: ReactPriorityLevel,
113
-};
112
+|};
113
115
-type UpdateQueue<S, A> = {
114
+type UpdateQueue<S, A> = {|
115
pending: Update<S, A> | null,
116
dispatch: (A => mixed) | null,
117
lastRenderedReducer: ((S, A) => S) | null,
118
lastRenderedState: S | null,
120
-};
119
+|};
120
121
export type HookType =
122
| 'useState'
@@ -139,27 +138,23 @@ if (__DEV__) {
138
didWarnAboutMismatchedHooksForComponent = new Set();
139
}
140
142
-export type Hook = {
141
+export type Hook = {|
142
memoizedState: any,
144
-
143
baseState: any,
144
baseQueue: Update<any, any> | null,
145
queue: UpdateQueue<any, any> | null,
148
-
146
next: Hook | null,
150
-};
147
+|};
148
152
-type Effect = {
149
+type Effect = {|
150
tag: HookEffectTag,
151
create: () => (() => void) | void,
152
destroy: (() => void) | void,
153
deps: Array<mixed> | null,
154
next: Effect,
158
-};
155
+|};
156
160
-export type FunctionComponentUpdateQueue = {
161
- lastEffect: Effect | null,
162
-};
157
+export type FunctionComponentUpdateQueue = {|lastEffect: Effect | null|};
158
159
export type TimeoutConfig = {|
160
timeoutMs: number,
@@ -885,7 +880,7 @@ function pushEffect(tag, create, destroy, deps) {
880
return effect;
881
}
882
888
-function mountRef<T>(initialValue: T): {current: T} {
883
+function mountRef<T>(initialValue: T): {|current: T|} {
884
const hook = mountWorkInProgressHook();
885
const ref = {current: initialValue};
886
if (__DEV__) {
@@ -895,7 +890,7 @@ function mountRef<T>(initialValue: T): {current: T} {
890
return ref;
891
}
892
898
-function updateRef<T>(initialValue: T): {current: T} {
893
+function updateRef<T>(initialValue: T): {|current: T|} {
894
const hook = updateWorkInProgressHook();
895
return hook.memoizedState;
896
}
@@ -991,7 +986,7 @@ function updateLayoutEffect(
986
987
function imperativeHandleEffect<T>(
988
create: () => T,
994
- ref: {current: T | null} | ((inst: T | null) => mixed) | null | void,
989
+ ref: {|current: T | null|} | ((inst: T | null) => mixed) | null | void,
990
) {
991
if (typeof ref === 'function') {
992
const refCallback = ref;
@@ -1020,7 +1015,7 @@ function imperativeHandleEffect<T>(
1015
}
1016
1017
function mountImperativeHandle<T>(
1023
- ref: {current: T | null} | ((inst: T | null) => mixed) | null | void,
1018
+ ref: {|current: T | null|} | ((inst: T | null) => mixed) | null | void,
1019
create: () => T,
1020
deps: Array<mixed> | void | null,
1021
): void {
@@ -1047,7 +1042,7 @@ function mountImperativeHandle<T>(
1042
}
1043
1044
function updateImperativeHandle<T>(
1050
- ref: {current: T | null} | ((inst: T | null) => mixed) | null | void,
1045
+ ref: {|current: T | null|} | ((inst: T | null) => mixed) | null | void,
1046
create: () => T,
1047
deps: Array<mixed> | void | null,
1048
): void {
@@ -1464,7 +1459,7 @@ if (__DEV__) {
1459
return mountEffect(create, deps);
1460
},
1461
useImperativeHandle<T>(
1467
- ref: {current: T | null} | ((inst: T | null) => mixed) | null | void,
1462
+ ref: {|current: T | null|} | ((inst: T | null) => mixed) | null | void,
1463
create: () => T,
1464
deps: Array<mixed> | void | null,
1465
): void {
@@ -1509,7 +1504,7 @@ if (__DEV__) {
1504
ReactCurrentDispatcher.current = prevDispatcher;
1505
}
1506
},
1512
- useRef<T>(initialValue: T): {current: T} {
1507
+ useRef<T>(initialValue: T): {|current: T|} {
1508
currentHookNameInDev = 'useRef';
1509
mountHookTypesDev();
1510
return mountRef(initialValue);
@@ -1584,7 +1579,7 @@ if (__DEV__) {
1579
return mountEffect(create, deps);
1580
},
1581
useImperativeHandle<T>(
1587
- ref: {current: T | null} | ((inst: T | null) => mixed) | null | void,
1582
+ ref: {|current: T | null|} | ((inst: T | null) => mixed) | null | void,
1583
create: () => T,
1584
deps: Array<mixed> | void | null,
1585
): void {
@@ -1626,7 +1621,7 @@ if (__DEV__) {
1621
ReactCurrentDispatcher.current = prevDispatcher;
1622
}
1623
},
1629
- useRef<T>(initialValue: T): {current: T} {
1624
+ useRef<T>(initialValue: T): {|current: T|} {
1625
currentHookNameInDev = 'useRef';
1626
updateHookTypesDev();
1627
return mountRef(initialValue);
@@ -1701,7 +1696,7 @@ if (__DEV__) {
1696
return updateEffect(create, deps);
1697
},
1698
useImperativeHandle<T>(
1704
- ref: {current: T | null} | ((inst: T | null) => mixed) | null | void,
1699
+ ref: {|current: T | null|} | ((inst: T | null) => mixed) | null | void,
1700
create: () => T,
1701
deps: Array<mixed> | void | null,
1702
): void {
@@ -1743,7 +1738,7 @@ if (__DEV__) {
1738
ReactCurrentDispatcher.current = prevDispatcher;
1739
}
1740
},
1746
- useRef<T>(initialValue: T): {current: T} {
1741
+ useRef<T>(initialValue: T): {|current: T|} {
1742
currentHookNameInDev = 'useRef';
1743
updateHookTypesDev();
1744
return updateRef(initialValue);
@@ -1822,7 +1817,7 @@ if (__DEV__) {
1817
return mountEffect(create, deps);
1818
},
1819
useImperativeHandle<T>(
1825
- ref: {current: T | null} | ((inst: T | null) => mixed) | null | void,
1820
+ ref: {|current: T | null|} | ((inst: T | null) => mixed) | null | void,
1821
create: () => T,
1822
deps: Array<mixed> | void | null,
1823
): void {
@@ -1868,7 +1863,7 @@ if (__DEV__) {
1863
ReactCurrentDispatcher.current = prevDispatcher;
1864
}
1865
},
1871
- useRef<T>(initialValue: T): {current: T} {
1866
+ useRef<T>(initialValue: T): {|current: T|} {
1867
currentHookNameInDev = 'useRef';
1868
warnInvalidHookAccess();
1869
mountHookTypesDev();
@@ -1953,7 +1948,7 @@ if (__DEV__) {
1948
return updateEffect(create, deps);
1949
},
1950
useImperativeHandle<T>(
1956
- ref: {current: T | null} | ((inst: T | null) => mixed) | null | void,
1951
+ ref: {|current: T | null|} | ((inst: T | null) => mixed) | null | void,
1952
create: () => T,
1953
deps: Array<mixed> | void | null,
1954
): void {
@@ -1999,7 +1994,7 @@ if (__DEV__) {
1994
ReactCurrentDispatcher.current = prevDispatcher;
1995
}
1996
},
2002
- useRef<T>(initialValue: T): {current: T} {
1997
+ useRef<T>(initialValue: T): {|current: T|} {
1998
currentHookNameInDev = 'useRef';
1999
warnInvalidHookAccess();
2000
updateHookTypesDev();
packages/react-reconciler/src/ReactFiberNewContext.js
+1
@@ -16,6 +16,7 @@ export type ContextDependency<T> = {
16
context: ReactContext<T>,
17
observedBits: number,
18
next: ContextDependency<mixed> | null,
19
+ ...
20
};
21
22
import {isPrimaryRenderer} from './ReactFiberHostConfig';
packages/react-reconciler/src/ReactFiberRoot.js
+1
@@ -100,6 +100,7 @@ export type FiberRoot = {
100
...BaseFiberRootProperties,
101
...ProfilingOnlyFiberRootProperties,
102
...SuspenseCallbackOnlyFiberRootProperties,
103
+ ...
104
};
105
106
function FiberRootNode(containerInfo, tag, hydrate) {
packages/react-reconciler/src/ReactFiberStack.js
+1
-3
@@ -9,9 +9,7 @@
9
10
import type {Fiber} from './ReactFiber';
11
12
-export type StackCursor<T> = {
13
- current: T,
14
-};
12
+export type StackCursor<T> = {|current: T|};
13
14
const valueStack: Array<any> = [];
15
packages/react-reconciler/src/ReactFiberSuspenseComponent.js
+1
@@ -20,6 +20,7 @@ import {
20
export type SuspenseHydrationCallbacks = {
21
onHydrated?: (suspenseInstance: SuspenseInstance) => void,
22
onDeleted?: (suspenseInstance: SuspenseInstance) => void,
23
+ ...
24
};
25
26
// A null SuspenseState represents an unsuspended normal Suspense boundary.
packages/react-reconciler/src/ReactFiberWorkLoop.js
+1
-1
@@ -211,9 +211,9 @@ const RootCompleted = 5;
211
212
export type Thenable = {
213
then(resolve: () => mixed, reject?: () => mixed): Thenable | void,
214
-
214
// Special flag to opt out of tracing interactions across a Suspense boundary.
215
__reactDoNotTraceInteractions?: boolean,
216
+ ...
217
};
218
219
// Describes where we are in the React execution stack
packages/react-reconciler/src/ReactProfilerTimer.js
+1
@@ -23,6 +23,7 @@ export type ProfilerTimer = {
23
startProfilerTimer(fiber: Fiber): void,
24
stopProfilerTimerIfRunning(fiber: Fiber): void,
25
stopProfilerTimerIfRunningAndRecordDelta(fiber: Fiber): void,
26
+ ...
27
};
28
29
let commitTime: number = 0;
packages/react-reconciler/src/ReactUpdateQueue.js
+6
-8
@@ -107,7 +107,7 @@ import {
107
import invariant from 'shared/invariant';
108
import {getCurrentPriorityLevel} from './SchedulerWithReactIntegration';
109
110
-export type Update<State> = {
110
+export type Update<State> = {|
111
expirationTime: ExpirationTime,
112
suspenseConfig: null | SuspenseConfig,
113
@@ -117,20 +117,18 @@ export type Update<State> = {
117
118
next: Update<State>,
119
120
- //DEV only
120
+ // DEV only
121
priority?: ReactPriorityLevel,
122
-};
122
+|};
123
124
-type SharedQueue<State> = {
125
- pending: Update<State> | null,
126
-};
124
+type SharedQueue<State> = {|pending: Update<State> | null|};
125
128
-export type UpdateQueue<State> = {
126
+export type UpdateQueue<State> = {|
127
baseState: State,
128
baseQueue: Update<State> | null,
129
shared: SharedQueue<State>,
130
effects: Array<Update<State>> | null,
133
-};
131
+|};
132
133
export const UpdateState = 0;
134
export const ReplaceState = 1;
packages/react-reconciler/src/SchedulerWithReactIntegration.js
+1
-3
@@ -46,9 +46,7 @@ if (enableSchedulerTracing) {
46
export type ReactPriorityLevel = 99 | 98 | 97 | 96 | 95 | 90;
47
export type SchedulerCallback = (isSync: boolean) => SchedulerCallback | null;
48
49
-type SchedulerCallbackOptions = {
50
- timeout?: number,
51
-};
49
+type SchedulerCallbackOptions = {timeout?: number, ...};
50
51
const fakeCallbackNode = {};
52
packages/react-refresh/src/ReactFreshRuntime.js
+1
-1
@@ -488,7 +488,7 @@ export function injectIntoGlobalHook(globalObject: any): void {
488
hook.onScheduleFiberRoot = function(
489
id: number,
490
root: FiberRoot,
491
- children: mixed,
491
+ children: ReactNodeList,
492
) {
493
if (!isPerformingRefresh) {
494
// If it was intentionally scheduled, don't attempt to restore.
packages/react-server/src/ReactFizzStreamer.js
+1
@@ -26,6 +26,7 @@ type OpaqueRequest = {
26
children: ReactNodeList,
27
completedChunks: Array<Uint8Array>,
28
flowing: boolean,
29
+ ...
30
};
31
32
export function createRequest(
packages/react-server/src/ReactFlightServer.js
+3
-3
@@ -95,14 +95,13 @@ type ReactJSONValue =
95
| Array<ReactModel>
96
| ReactModelObject;
97
98
-type ReactModelObject = {
99
- +[key: string]: ReactModel,
100
-};
98
+type ReactModelObject = {+[key: string]: ReactModel, ...};
99
100
type Segment = {
101
id: number,
102
model: ReactModel,
103
ping: () => void,
104
+ ...
105
};
106
107
type OpaqueRequest = {
@@ -114,6 +113,7 @@ type OpaqueRequest = {
113
completedErrorChunks: Array<Uint8Array>,
114
flowing: boolean,
115
toJSON: (key: string, value: ReactModel) => ReactJSONValue,
116
+ ...
117
};
118
119
export function createRequest(
packages/react-server/src/ReactServerHostConfigNode.js
+3
-1
@@ -11,7 +11,9 @@ import type {Writable} from 'stream';
11
12
type MightBeFlushable = {
13
flush?: () => void,
14
- flushHeaders?: () => void, // Legacy
14
+ // Legacy
15
+ flushHeaders?: () => void,
16
+ ...
17
};
18
19
export type Destination = Writable & MightBeFlushable;
packages/react-test-renderer/src/ReactShallowRenderer.js
+7
-7
@@ -27,21 +27,21 @@ import type {ReactElement} from 'shared/ReactElementType';
27
type BasicStateAction<S> = (S => S) | S;
28
type Dispatch<A> = A => void;
29
30
-type Update<A> = {
30
+type Update<A> = {|
31
action: A,
32
next: Update<A> | null,
33
-};
33
+|};
34
35
-type UpdateQueue<A> = {
35
+type UpdateQueue<A> = {|
36
first: Update<A> | null,
37
dispatch: any,
38
-};
38
+|};
39
40
-type Hook = {
40
+type Hook = {|
41
memoizedState: any,
42
queue: UpdateQueue<any> | null,
43
next: Hook | null,
44
-};
44
+|};
45
46
const {ReactCurrentDispatcher} = ReactSharedInternals;
47
@@ -340,7 +340,7 @@ class ReactShallowRenderer {
340
return nextValue;
341
};
342
343
- const useRef = <T>(initialValue: T): {current: T} => {
343
+ const useRef = <T>(initialValue: T): {|current: T|} => {
344
this._validateCurrentlyRenderingComponent();
345
this._createWorkInProgressHook();
346
const previousRef = (this._workInProgressHook: any).memoizedState;
packages/react-test-renderer/src/ReactTestHostConfig.js
+2
-2
@@ -195,7 +195,7 @@ export function prepareUpdate(
195
newProps: Props,
196
rootContainerInstance: Container,
197
hostContext: Object,
198
-): null | {} {
198
+): null | {...} {
199
return UPDATE_SIGNAL;
200
}
201
@@ -246,7 +246,7 @@ export const supportsMutation = true;
246
247
export function commitUpdate(
248
instance: Instance,
249
- updatePayload: {},
249
+ updatePayload: {...},
250
type: string,
251
oldProps: Props,
252
newProps: Props,
packages/react-test-renderer/src/ReactTestRenderer.js
+3
-1
@@ -50,11 +50,12 @@ import {ConcurrentRoot, LegacyRoot} from 'shared/ReactRootTags';
50
type TestRendererOptions = {
51
createNodeMock: (element: React$Element<any>) => any,
52
unstable_isConcurrent: boolean,
53
+ ...
54
};
55
56
type ReactTestRendererJSON = {|
57
type: string,
57
- props: {[propName: string]: any},
58
+ props: {[propName: string]: any, ...},
59
children: null | Array<ReactTestRendererNode>,
60
$$typeof?: Symbol, // Optional because we add it with defineProperty().
61
|};
@@ -64,6 +65,7 @@ type FindOptions = $Shape<{
65
// performs a "greedy" search: if a matching node is found, will continue
66
// to search within the matching node's children. (default: true)
67
deep: boolean,
68
+ ...
69
}>;
70
71
export type Predicate = (node: ReactTestInstance) => ?boolean;
packages/react/src/ReactHooks.js
+2
-2
@@ -86,7 +86,7 @@ export function useReducer<S, I, A>(
86
return dispatcher.useReducer(reducer, initialArg, init);
87
}
88
89
-export function useRef<T>(initialValue: T): {current: T} {
89
+export function useRef<T>(initialValue: T): {|current: T|} {
90
const dispatcher = resolveDispatcher();
91
return dispatcher.useRef(initialValue);
92
}
@@ -124,7 +124,7 @@ export function useMemo(
124
}
125
126
export function useImperativeHandle<T>(
127
- ref: {current: T | null} | ((inst: T | null) => mixed) | null | void,
127
+ ref: {|current: T | null|} | ((inst: T | null) => mixed) | null | void,
128
create: () => T,
129
inputs: Array<mixed> | void | null,
130
): void {
packages/scheduler/src/SchedulerMinHeap.js
+2
-2
@@ -8,10 +8,10 @@
8
*/
9
10
type Heap = Array<Node>;
11
-type Node = {
11
+type Node = {|
12
id: number,
13
sortIndex: number,
14
-};
14
+|};
15
16
export function push(heap: Heap, node: Node): void {
17
const index = heap.length;
packages/scheduler/src/SchedulerProfiling.js
+14
-3
@@ -103,7 +103,11 @@ export function stopLoggingProfilingEvents(): ArrayBuffer | null {
103
}
104
105
export function markTaskStart(
106
- task: {id: number, priorityLevel: PriorityLevel},
106
+ task: {
107
+ id: number,
108
+ priorityLevel: PriorityLevel,
109
+ ...
110
+ },
111
ms: number,
112
) {
113
if (enableProfiling) {
@@ -122,6 +126,7 @@ export function markTaskCompleted(
126
task: {
127
id: number,
128
priorityLevel: PriorityLevel,
129
+ ...
130
},
131
ms: number,
132
) {
@@ -140,6 +145,7 @@ export function markTaskCanceled(
145
task: {
146
id: number,
147
priorityLevel: PriorityLevel,
148
+ ...
149
},
150
ms: number,
151
) {
@@ -156,6 +162,7 @@ export function markTaskErrored(
162
task: {
163
id: number,
164
priorityLevel: PriorityLevel,
165
+ ...
166
},
167
ms: number,
168
) {
@@ -171,7 +178,11 @@ export function markTaskErrored(
178
}
179
180
export function markTaskRun(
174
- task: {id: number, priorityLevel: PriorityLevel},
181
+ task: {
182
+ id: number,
183
+ priorityLevel: PriorityLevel,
184
+ ...
185
+ },
186
ms: number,
187
) {
188
if (enableProfiling) {
@@ -187,7 +198,7 @@ export function markTaskRun(
198
}
199
}
200
190
-export function markTaskYield(task: {id: number}, ms: number) {
201
+export function markTaskYield(task: {id: number, ...}, ms: number) {
202
if (enableProfiling) {
203
profilingState[PRIORITY] = NoPriority;
204
profilingState[CURRENT_TASK_ID] = 0;
packages/scheduler/src/Tracing.js
+3
-6
@@ -45,15 +45,12 @@ export type Subscriber = {
45
// A batch of work has completed for a set of interactions.
46
// Work is done by a "thread" which is identified by a unique ID.
47
onWorkStopped: (interactions: Set<Interaction>, threadID: number) => void,
48
+ ...
49
};
50
50
-export type InteractionsRef = {
51
- current: Set<Interaction>,
52
-};
51
+export type InteractionsRef = {|current: Set<Interaction>|};
52
54
-export type SubscriberRef = {
55
- current: Subscriber | null,
56
-};
53
+export type SubscriberRef = {|current: Subscriber | null|};
54
55
const DEFAULT_THREAD_ID = 0;
56
packages/shared/ReactDOMTypes.js
+2
@@ -30,6 +30,7 @@ export type ReactDOMResponderEvent = {
30
pointerType: PointerType,
31
target: Element | Document,
32
type: string,
33
+ ...
34
};
35
36
export type ReactDOMEventResponder = ReactEventResponder<
@@ -72,4 +73,5 @@ export type ReactDOMResponderContext = {
73
// Used for controller components
74
enqueueStateRestore(Element | Document): void,
75
getResponderNode(): Element | null,
76
+ ...
77
};
packages/shared/ReactElementType.js
+7
-8
@@ -7,24 +7,23 @@
7
* @flow
8
*/
9
10
-export type Source = {
10
+export type Source = {|
11
fileName: string,
12
lineNumber: number,
13
-};
13
+|};
14
15
-export type ReactElement = {
15
+export type ReactElement = {|
16
$$typeof: any,
17
type: any,
18
key: any,
19
ref: any,
20
props: any,
21
- _owner: any, // ReactInstance or ReactFiber
21
+ // ReactFiber
22
+ _owner: any,
23
24
// __DEV__
24
- _store: {
25
- validated: boolean,
26
- },
25
+ _store: {validated: boolean, ...},
26
_self: React$Element<any>,
27
_shadowChildren: any,
28
_source: Source,
30
-};
29
+|};
packages/shared/ReactLazyComponent.js
+5
-2
@@ -9,20 +9,23 @@
9
10
export type Thenable<T, R> = {
11
then(resolve: (T) => mixed, reject: (mixed) => mixed): R,
12
+ ...
13
};
14
15
export type LazyComponent<T> = {
16
$$typeof: Symbol | number,
16
- _ctor: () => Thenable<{default: T}, mixed>,
17
+ _ctor: () => Thenable<{default: T, ...}, mixed>,
18
_status: 0 | 1 | 2,
19
_result: any,
20
+ ...
21
};
22
23
type ResolvedLazyComponent<T> = {
24
$$typeof: Symbol | number,
23
- _ctor: () => Thenable<{default: T}, mixed>,
25
+ _ctor: () => Thenable<{default: T, ...}, mixed>,
26
_status: 1,
27
_result: any,
28
+ ...
29
};
30
31
export const Uninitialized = -1;
packages/shared/ReactTypes.js
+10
-3
@@ -31,12 +31,15 @@ export type ReactProvider<T> = {
31
props: {
32
value: T,
33
children?: ReactNodeList,
34
+ ...
35
},
36
+ ...
37
};
38
39
export type ReactProviderType<T> = {
40
$$typeof: Symbol | number,
41
_context: ReactContext<T>,
42
+ ...
43
};
44
45
export type ReactConsumer<T> = {
@@ -47,23 +50,23 @@ export type ReactConsumer<T> = {
50
props: {
51
children: (value: T) => ReactNodeList,
52
unstable_observedBits?: number,
53
+ ...
54
},
55
+ ...
56
};
57
58
export type ReactContext<T> = {
59
$$typeof: Symbol | number,
60
Consumer: ReactContext<T>,
61
Provider: ReactProviderType<T>,
57
-
62
_calculateChangedBits: ((a: T, b: T) => number) | null,
59
-
63
_currentValue: T,
64
_currentValue2: T,
65
_threadCount: number,
63
-
66
// DEV only
67
_currentRenderer?: Object | null,
68
_currentRenderer2?: Object | null,
69
+ ...
70
};
71
72
export type ReactPortal = {
@@ -73,6 +76,7 @@ export type ReactPortal = {
76
children: ReactNodeList,
77
// TODO: figure out the API for cross-renderer implementation.
78
implementation: any,
79
+ ...
80
};
81
82
export type RefObject = {|
@@ -97,6 +101,7 @@ export type ReactEventResponder<E, C> = {
101
displayName: string,
102
targetEventTypes: null | Array<string>,
103
targetPortalPropagation: boolean,
104
+ rootEventTypes: null | Array<string>,
105
getInitialState: null | ((props: Object) => Object),
106
onEvent:
107
| null
@@ -106,6 +111,7 @@ export type ReactEventResponder<E, C> = {
111
| ((event: E, context: C, props: Object, state: Object) => void),
112
onMount: null | ((context: C, props: Object, state: Object) => void),
113
onUnmount: null | ((context: C, props: Object, state: Object) => void),
114
+ ...
115
};
116
117
export type EventPriority = 0 | 1 | 2;
@@ -152,6 +158,7 @@ export type ReactFundamentalImpl<C, H> = {
158
) => void,
159
onHydrate?: (context: C, props: Object, state: Object) => boolean,
160
onFocus?: (context: C, props: Object, state: Object) => boolean,
161
+ ...
162
};
163
164
export type ReactFundamentalComponent<C, H> = {|
packages/shared/isTextInputElement.js
+1
-1
@@ -10,7 +10,7 @@
10
/**
11
* @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
12
*/
13
-const supportedInputTypes: {[key: string]: true | void} = {
13
+const supportedInputTypes: {[key: string]: true | void, ...} = {
14
color: true,
15
date: true,
16
datetime: true,
scripts/error-codes/Types.js
+1
-1
@@ -8,5 +8,5 @@
8
*/
9
'use strict';
10
11
-/*:: export type ErrorMap = { [id: string]: string; }; */
11
+/*:: export type ErrorMap = { [id: string]: string, ... }; */
12
scripts/flow/config/flowconfig
+1
-1
@@ -49,4 +49,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
49
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
50
51
[version]
52
-^0.72.0
\ No newline at end of file
52
+^0.84.0
\ No newline at end of file
scripts/flow/environment.js
+3
-4
@@ -32,9 +32,7 @@ declare module 'ReactFeatureFlags' {
32
33
// ReactFiberErrorDialog www fork
34
declare module 'ReactFiberErrorDialog' {
35
- declare module.exports: {
36
- showErrorDialog: (error: mixed) => boolean,
37
- };
35
+ declare module.exports: {showErrorDialog: (error: mixed) => boolean, ...};
36
}
37
38
// EventListener www fork
@@ -45,7 +43,7 @@ declare module 'EventListener' {
43
type: string,
44
callback: Function,
45
priority?: number,
48
- options?: {passive: boolean},
46
+ options?: {passive: boolean, ...},
47
) => mixed,
48
capture: (target: Element, type: string, callback: Function) => mixed,
49
captureWithPassiveFlag: (
@@ -54,5 +52,6 @@ declare module 'EventListener' {
52
callback: Function,
53
passive: boolean,
54
) => mixed,
55
+ ...
56
};
57
}
scripts/flow/react-native-host-hooks.js
+9
-3
@@ -37,17 +37,18 @@ declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface'
37
declare export function flattenStyle(style: any): any;
38
declare export var RCTEventEmitter: {
39
register: (eventEmitter: mixed) => void,
40
+ ...
41
};
42
declare export var TextInputState: {
43
blurTextInput: (object: any) => void,
44
focusTextInput: (object: any) => void,
45
+ ...
46
};
47
declare export var ReactFiberErrorDialog: {
48
showErrorDialog: (error: CapturedError) => boolean,
49
+ ...
50
};
48
- declare export var Platform: {
49
- OS: string,
50
- };
51
+ declare export var Platform: {OS: string, ...};
52
declare export var UIManager: {
53
customBubblingEventTypes: Object,
54
customDirectEventTypes: Object,
@@ -90,13 +91,16 @@ declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface'
91
height?: number,
92
format?: 'png' | 'jpeg',
93
quality?: number,
94
+ ...
95
},
96
) => Promise<any>,
97
setJSResponder: (reactTag: number, blockNativeResponder: boolean) => void,
98
clearJSResponder: () => void,
99
+ ...
100
};
101
declare export var BatchedBridge: {
102
registerCallableModule: (name: string, module: Object) => void,
103
+ ...
104
};
105
declare export var ReactNativeViewConfigRegistry: {
106
customBubblingEventTypes: Object,
@@ -105,6 +109,7 @@ declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface'
109
110
register: (name: string, callback: ViewConfigGetter) => string,
111
get: (name: string) => ReactNativeBaseComponentViewConfig,
112
+ ...
113
};
114
}
115
@@ -151,6 +156,7 @@ declare var nativeFabricUIManager: {
156
onFail: () => void,
157
onSuccess: MeasureLayoutOnSuccessCallback,
158
) => void,
159
+ ...
160
};
161
162
declare module 'View' {
scripts/print-warnings/print-warnings.js
+4
-4
@@ -6,7 +6,7 @@
6
*/
7
'use strict';
8
9
-const babylon = require('babylon');
9
+const babelParser = require('@babel/parser');
10
const fs = require('fs');
11
const through = require('through2');
12
const traverse = require('@babel/traverse').default;
@@ -14,9 +14,9 @@ const gs = require('glob-stream');
14
15
const evalToString = require('../shared/evalToString');
16
17
-const babylonOptions = {
17
+const parserOptions = {
18
sourceType: 'module',
19
- // As a parser, babylon has its own options and we can't directly
19
+ // babelParser has its own options and we can't directly
20
// import/require a babel preset. It should be kept **the same** as
21
// the `babel-plugin-syntax-*` ones specified in
22
// https://github.com/facebook/fbjs/blob/master/packages/babel-preset-fbjs/configure.js
@@ -40,7 +40,7 @@ function transform(file, enc, cb) {
40
41
let ast;
42
try {
43
- ast = babylon.parse(source, babylonOptions);
43
+ ast = babelParser.parse(source, parserOptions);
44
} catch (error) {
45
console.error('Failed to parse source file:', file.path);
46
throw error;
scripts/rollup/shims/react-native/ReactFeatureFlags.js
+1
-1
@@ -5,7 +5,7 @@
5
* LICENSE file in the root directory of this source tree.
6
*
7
* @format
8
- * @flow
8
+ * @flow strict-local
9
*/
10
11
'use strict';
scripts/rollup/shims/react-native/ReactNativeViewConfigRegistry.js
+2
@@ -27,11 +27,13 @@ const customBubblingEventTypes: {
27
bubbled: string,
28
|}>,
29
|}>,
30
+ ...,
31
} = {};
32
const customDirectEventTypes: {
33
[eventName: string]: $ReadOnly<{|
34
registrationName: string,
35
|}>,
36
+ ...,
37
} = {};
38
39
exports.customBubblingEventTypes = customBubblingEventTypes;
yarn.lock
+5
-5
@@ -2723,7 +2723,7 @@ babel-types@^6.24.1, babel-types@^6.26.0:
2723
lodash "^4.17.4"
2724
to-fast-properties "^1.0.3"
2725
2726
-babylon@6.18.0, babylon@^6.18.0:
2726
+babylon@^6.18.0:
2727
version "6.18.0"
2728
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3"
2729
integrity sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==
@@ -5696,10 +5696,10 @@ flatted@^2.0.0:
5696
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08"
5697
integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==
5698
5699
-flow-bin@^0.72.0:
5700
- version "0.72.0"
5701
- resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.72.0.tgz#12051180fb2db7ccb728fefe67c77e955e92a44d"
5702
- integrity sha1-EgURgPstt8y3KP7+Z8d+lV6SpE0=
5699
+flow-bin@^0.84.0:
5700
+ version "0.84.0"
5701
+ resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.84.0.tgz#4cb2364c750fb37a7840524fa62456b53f64cdcb"
5702
+ integrity sha512-ocji8eEYp+YfICsm+F6cIHUcD7v5sb0/ADEXm6gyUKdjQzmSckMrPUdZtyfP973t3YGHKliUMxMvIBHyR5LbXQ==
5703
5704
fluent-syntax@0.13.0:
5705
version "0.13.0"