@samitouri / QOS-React-2 / commits / 8a9e7b6cef

Flow: implicit-inexact-object=error (#25210)

* implicit-inexact-object=error * default everything ambiguous to exact object * inexact where exact causes errors

Jan Kassens committed Sep 9, 2022 at 10:13 UTC 8a9e7b6cefb5e7e94333c7d5fe2cca6541776d5b
83 files changed +323 -292
packages/react-client/src/ReactFlightClient.js
+17 -12
@@ -34,7 +34,7 @@ export type JSONValue =
34 | null
35 | boolean
36 | string
37 - | {+[key: string]: JSONValue}
37 + | {|+[key: string]: JSONValue|}
38 | $ReadOnlyArray<JSONValue>;
39
40 const PENDING = 0;
@@ -43,36 +43,36 @@ const RESOLVED_MODULE = 2;
43 const INITIALIZED = 3;
44 const ERRORED = 4;
45
46 -type PendingChunk = {
46 +type PendingChunk = {|
47 _status: 0,
48 _value: null | Array<() => mixed>,
49 _response: Response,
50 then(resolve: () => mixed): void,
51 -};
52 -type ResolvedModelChunk = {
51 +|};
52 +type ResolvedModelChunk = {|
53 _status: 1,
54 _value: UninitializedModel,
55 _response: Response,
56 then(resolve: () => mixed): void,
57 -};
58 -type ResolvedModuleChunk<T> = {
57 +|};
58 +type ResolvedModuleChunk<T> = {|
59 _status: 2,
60 _value: ModuleReference<T>,
61 _response: Response,
62 then(resolve: () => mixed): void,
63 -};
64 -type InitializedChunk<T> = {
63 +|};
64 +type InitializedChunk<T> = {|
65 _status: 3,
66 _value: T,
67 _response: Response,
68 then(resolve: () => mixed): void,
69 -};
70 -type ErroredChunk = {
69 +|};
70 +type ErroredChunk = {|
71 _status: 4,
72 _value: Error,
73 _response: Response,
74 then(resolve: () => mixed): void,
75 -};
75 +|};
76 type SomeChunk<T> =
77 | PendingChunk
78 | ResolvedModelChunk
@@ -129,10 +129,12 @@ function readRoot<T>(): T {
129 }
130
131 function createPendingChunk(response: Response): PendingChunk {
132 + // $FlowFixMe Flow doesn't support functions as constructors
133 return new Chunk(PENDING, null, response);
134 }
135
136 function createErrorChunk(response: Response, error: Error): ErroredChunk {
137 + // $FlowFixMe Flow doesn't support functions as constructors
138 return new Chunk(ERRORED, error, response);
139 }
140
@@ -140,6 +142,7 @@ function createInitializedChunk<T>(
142 response: Response,
143 value: T,
144 ): InitializedChunk<T> {
145 + // $FlowFixMe Flow doesn't support functions as constructors
146 return new Chunk(INITIALIZED, value, response);
147 }
148
@@ -168,6 +171,7 @@ function createResolvedModelChunk(
171 response: Response,
172 value: UninitializedModel,
173 ): ResolvedModelChunk {
174 + // $FlowFixMe Flow doesn't support functions as constructors
175 return new Chunk(RESOLVED_MODEL, value, response);
176 }
177
@@ -175,6 +179,7 @@ function createResolvedModuleChunk<T>(
179 response: Response,
180 value: ModuleReference<T>,
181 ): ResolvedModuleChunk<T> {
182 + // $FlowFixMe Flow doesn't support functions as constructors
183 return new Chunk(RESOLVED_MODULE, value, response);
184 }
185
@@ -333,7 +338,7 @@ export function parseModelString(
338
339 export function parseModelTuple(
340 response: Response,
336 - value: {+[key: string]: JSONValue} | $ReadOnlyArray<JSONValue>,
341 + value: {|+[key: string]: JSONValue|} | $ReadOnlyArray<JSONValue>,
342 ): any {
343 const tuple: [mixed, mixed, mixed, mixed] = (value: any);
344
packages/react-client/src/ReactFlightClientHostConfigStream.js
+2 -2
@@ -10,11 +10,11 @@
10 import type {ResponseBase} from './ReactFlightClient';
11 import type {StringDecoder} from './ReactFlightClientHostConfig';
12
13 -export type Response = ResponseBase & {
13 +export type Response = ResponseBase & {|
14 _partialRow: string,
15 _fromJSON: (key: string, value: JSONValue) => any,
16 _stringDecoder: StringDecoder,
17 -};
17 +|};
18
19 export type UninitializedModel = string;
20
packages/react-debug-tools/src/ReactDebugHooks.js
+4 -4
@@ -51,10 +51,10 @@ type Dispatch<A> = A => void;
51
52 let primitiveStackCache: null | Map<string, Array<any>> = null;
53
54 -type Hook = {
54 +type Hook = {|
55 memoizedState: any,
56 next: Hook | null,
57 -};
57 +|};
58
59 function getPrimitiveStackCache(): Map<string, Array<any>> {
60 // This initializes a cache of all primitive hooks so that the top
@@ -371,12 +371,12 @@ const DispatcherProxy = new Proxy(Dispatcher, DispatcherProxyHandler);
371
372 // Inspect
373
374 -export type HookSource = {
374 +export type HookSource = {|
375 lineNumber: number | null,
376 columnNumber: number | null,
377 fileName: string | null,
378 functionName: string | null,
379 -};
379 +|};
380
381 export type HooksNode = {
382 id: number | null,
packages/react-devtools-shared/src/Logger.js
+6 -6
@@ -34,24 +34,24 @@ export type LoggerEvent =
34 |}
35 | {|
36 +event_name: 'select-element',
37 - +metadata: {
37 + +metadata: {|
38 +source: string,
39 - },
39 + |},
40 |}
41 | {|
42 +event_name: 'inspect-element-button-clicked',
43 |}
44 | {|
45 +event_name: 'profiling-start',
46 - +metadata: {
46 + +metadata: {|
47 +current_tab: string,
48 - },
48 + |},
49 |}
50 | {|
51 +event_name: 'profiler-tab-changed',
52 - +metadata: {
52 + +metadata: {|
53 +tabId: string,
54 - },
54 + |},
55 |}
56 | {|
57 +event_name: 'settings-changed',
packages/react-devtools-shared/src/backend/console.js
+2 -2
@@ -151,13 +151,13 @@ export function patch({
151 showInlineWarningsAndErrors,
152 hideConsoleLogsInStrictMode,
153 browserTheme,
154 -}: {
154 +}: {|
155 appendComponentStack: boolean,
156 breakOnConsoleErrors: boolean,
157 showInlineWarningsAndErrors: boolean,
158 hideConsoleLogsInStrictMode: boolean,
159 browserTheme: BrowserTheme,
160 -}): void {
160 +|}): void {
161 // Settings may change after we've patched the console.
162 // Using a shared ref allows the patch function to read the latest values.
163 consoleSettingsRef.appendComponentStack = appendComponentStack;
packages/react-devtools-shared/src/constants.js
+1 -1
@@ -79,7 +79,7 @@ import type {
79 DisplayDensity,
80 } from './devtools/views/Settings/SettingsContext';
81
82 -export const THEME_STYLES: {[style: Theme | DisplayDensity]: any} = {
82 +export const THEME_STYLES: {[style: Theme | DisplayDensity]: any, ...} = {
83 light: {
84 '--color-attribute-name': '#ef6632',
85 '--color-attribute-name-not-editable': '#23272f',
packages/react-devtools-shared/src/devtools/ContextMenu/useContextMenu.js
+1 -1
@@ -22,7 +22,7 @@ export default function useContextMenu({
22 data: Object,
23 id: string,
24 onChange?: OnChangeFn,
25 - ref: {current: ElementRef<*> | null},
25 + ref: {|current: ElementRef<*> | null|},
26 |}) {
27 const {showMenu} = useContext<RegistryContextType>(RegistryContext);
28
packages/react-devtools-shared/src/devtools/views/Components/InspectedElementErrorsAndWarningsTree.js
+1 -1
@@ -119,7 +119,7 @@ type TreeProps = {|
119 badgeClassName: string,
120 actions: React$Node,
121 className: string,
122 - clearMessages: () => {},
122 + clearMessages: () => void,
123 entries: Array<[string, number]>,
124 isTransitionPending: boolean,
125 label: string,
packages/react-devtools-shared/src/devtools/views/Profiler/HoveredFiberInfo.js
+2 -2
@@ -23,9 +23,9 @@ export type TooltipFiberData = {|
23 name: string,
24 |};
25
26 -export type Props = {
26 +export type Props = {|
27 fiberData: ChartNode,
28 -};
28 +|};
29
30 export default function HoveredFiberInfo({fiberData}: Props) {
31 const {profilerStore} = useContext(StoreContext);
packages/react-devtools-shared/src/devtools/views/Profiler/SnapshotCommitList.js
+2 -2
@@ -82,11 +82,11 @@ type ListProps = {|
82 width: number,
83 |};
84
85 -type DragState = {
85 +type DragState = {|
86 commitIndex: number,
87 left: number,
88 sizeIncrement: number,
89 -};
89 +|};
90
91 function List({
92 commitData,
packages/react-devtools-shared/src/hook.js
+2 -2
@@ -224,10 +224,10 @@ export function installHook(target: any): DevToolsHook | null {
224 function patchConsoleForInitialRenderInStrictMode({
225 hideConsoleLogsInStrictMode,
226 browserTheme,
227 - }: {
227 + }: {|
228 hideConsoleLogsInStrictMode: boolean,
229 browserTheme: BrowserTheme,
230 - }) {
230 + |}) {
231 const overrideConsoleMethods = [
232 'error',
233 'group',
packages/react-devtools-shared/src/hooks/astUtils.js
+2 -2
@@ -18,11 +18,11 @@ export type Position = {|
18 column: number,
19 |};
20
21 -export type SourceFileASTWithHookDetails = {
21 +export type SourceFileASTWithHookDetails = {|
22 sourceFileAST: File,
23 line: number,
24 source: string,
25 -};
25 +|};
26
27 export const NO_HOOK_NAME = '<no-hook>';
28
packages/react-devtools-shared/src/inspectedElementCache.js
+2 -2
@@ -168,12 +168,12 @@ export function checkForUpdate({
168 element,
169 refresh,
170 store,
171 -}: {
171 +}: {|
172 bridge: FrontendBridge,
173 element: Element,
174 refresh: RefreshFunction,
175 store: Store,
176 -}): void {
176 +|}): void {
177 const {id} = element;
178 const rendererID = store.getRendererIDForElement(id);
179 if (rendererID != null) {
packages/react-devtools-shared/src/node_modules/react-window/src/VariableSizeGrid.js
+1 -1
@@ -19,7 +19,7 @@ type ItemMetadata = {|
19 offset: number,
20 size: number,
21 |};
22 -type ItemMetadataMap = { [index: number]: ItemMetadata };
22 +type ItemMetadataMap = { [index: number]: ItemMetadata, ... };
23 type InstanceProps = {|
24 columnMetadataMap: ItemMetadataMap,
25 estimatedColumnWidth: number,
packages/react-devtools-shared/src/node_modules/react-window/src/VariableSizeList.js
+1 -1
@@ -18,7 +18,7 @@ type ItemMetadata = {|
18 size: number,
19 |};
20 type InstanceProps = {|
21 - itemMetadataMap: { [index: number]: ItemMetadata },
21 + itemMetadataMap: { [index: number]: ItemMetadata, ... },
22 estimatedItemSize: number,
23 lastMeasuredIndex: number,
24 |};
packages/react-devtools-timeline/src/CanvasPage.js
+1 -1
@@ -80,7 +80,7 @@ function CanvasPage({profilerData, viewState}: Props) {
80 className={styles.CanvasPage}
81 style={{backgroundColor: COLORS.BACKGROUND}}>
82 <AutoSizer>
83 - {({height, width}: {height: number, width: number}) => (
83 + {({height, width}: {|height: number, width: number|}) => (
84 <AutoSizedCanvas
85 data={profilerData}
86 height={height}
packages/react-devtools-timeline/src/types.js
+2 -2
@@ -17,11 +17,11 @@ export type Return<T> = Return_<*, T>;
17
18 // Project types
19
20 -export type ErrorStackFrame = {
20 +export type ErrorStackFrame = {|
21 fileName: string,
22 lineNumber: number,
23 columnNumber: number,
24 -};
24 +|};
25
26 export type Milliseconds = number;
27
packages/react-devtools-timeline/src/utils/useSmartTooltip.js
+2 -2
@@ -16,11 +16,11 @@ export default function useSmartTooltip({
16 canvasRef,
17 mouseX,
18 mouseY,
19 -}: {
19 +}: {|
20 canvasRef: {|current: HTMLCanvasElement | null|},
21 mouseX: number,
22 mouseY: number,
23 -}) {
23 +|}) {
24 const ref = useRef<HTMLElement | null>(null);
25
26 // HACK: Browser extension reports window.innerHeight of 0,
packages/react-devtools-timeline/src/view-base/resizable/ResizableView.js
+2 -2
@@ -47,7 +47,7 @@ const HIDDEN_RECT = {
47 };
48
49 export class ResizableView extends View {
50 - _canvasRef: {current: HTMLCanvasElement | null};
50 + _canvasRef: {|current: HTMLCanvasElement | null|};
51 _layoutState: LayoutState;
52 _mutableViewStateKey: string;
53 _resizeBar: ResizeBarView;
@@ -60,7 +60,7 @@ export class ResizableView extends View {
60 frame: Rect,
61 subview: View,
62 viewState: ViewState,
63 - canvasRef: {current: HTMLCanvasElement | null},
63 + canvasRef: {|current: HTMLCanvasElement | null|},
64 label: string,
65 ) {
66 super(surface, frame, noopLayout);
packages/react-devtools-timeline/src/view-base/utils/scrollState.js
+10 -10
@@ -35,12 +35,12 @@ function clampLength({
35 minContentLength,
36 maxContentLength,
37 containerLength,
38 -}: {
38 +}: {|
39 state: ScrollState,
40 minContentLength: number,
41 maxContentLength: number,
42 containerLength: number,
43 -}): ScrollState {
43 +|}): ScrollState {
44 return {
45 offset: state.offset,
46 length: clamp(
@@ -62,12 +62,12 @@ export function clampState({
62 minContentLength,
63 maxContentLength,
64 containerLength,
65 -}: {
65 +}: {|
66 state: ScrollState,
67 minContentLength: number,
68 maxContentLength: number,
69 containerLength: number,
70 -}): ScrollState {
70 +|}): ScrollState {
71 return clampOffset(
72 clampLength({
73 state,
@@ -83,11 +83,11 @@ export function translateState({
83 state,
84 delta,
85 containerLength,
86 -}: {
86 +}: {|
87 state: ScrollState,
88 delta: number,
89 containerLength: number,
90 -}): ScrollState {
90 +|}): ScrollState {
91 return clampOffset(
92 {
93 offset: state.offset + delta,
@@ -119,7 +119,7 @@ export function zoomState({
119 minContentLength,
120 maxContentLength,
121 containerLength,
122 -}: {
122 +}: {|
123 state: ScrollState,
124 multiplier: number,
125 fixedPoint: number,
@@ -127,7 +127,7 @@ export function zoomState({
127 minContentLength: number,
128 maxContentLength: number,
129 containerLength: number,
130 -}): ScrollState {
130 +|}): ScrollState {
131 // Length and offset must be computed separately, so that if the length is
132 // clamped the offset will still be correct (unless it gets clamped too).
133
@@ -164,7 +164,7 @@ export function moveStateToRange({
164 minContentLength,
165 maxContentLength,
166 containerLength,
167 -}: {
167 +}: {|
168 state: ScrollState,
169 rangeStart: number,
170 rangeEnd: number,
@@ -173,7 +173,7 @@ export function moveStateToRange({
173 minContentLength: number,
174 maxContentLength: number,
175 containerLength: number,
176 -}): ScrollState {
176 +|}): ScrollState {
177 // Length and offset must be computed separately, so that if the length is
178 // clamped the offset will still be correct (unless it gets clamped too).
179
packages/react-dom/src/client/ReactDOMHostConfig.js
+3 -3
@@ -733,7 +733,7 @@ export function isSuspenseInstanceFallback(instance: SuspenseInstance) {
733
734 export function getSuspenseInstanceFallbackErrorDetails(
735 instance: SuspenseInstance,
736 -): {digest: ?string, message?: string, stack?: string} {
736 +): {|digest: ?string, message?: string, stack?: string|} {
737 const dataset =
738 instance.nextSibling && ((instance.nextSibling: any): HTMLElement).dataset;
739 let digest, message, stack;
@@ -1320,10 +1320,10 @@ export function setFocusIfFocusable(node: Instance): boolean {
1320 return didFocus;
1321 }
1322
1323 -type RectRatio = {
1323 +type RectRatio = {|
1324 ratio: number,
1325 rect: BoundingRect,
1326 -};
1326 +|};
1327
1328 export function setupIntersectionObserver(
1329 targets: Array<Instance>,
packages/react-dom/src/events/ReactSyntheticEventType.js
+6 -6
@@ -20,7 +20,7 @@ export type DispatchConfig = {|
20 registrationName?: string,
21 |};
22
23 -type BaseSyntheticEvent = {
23 +type BaseSyntheticEvent = {|
24 isPersistent: () => boolean,
25 isPropagationStopped: () => boolean,
26 _dispatchInstances?: null | Array<Fiber | null> | Fiber,
@@ -31,14 +31,14 @@ type BaseSyntheticEvent = {
31 relatedTarget?: mixed,
32 type: string,
33 currentTarget: null | EventTarget,
34 -};
34 +|};
35
36 -export type KnownReactSyntheticEvent = BaseSyntheticEvent & {
36 +export type KnownReactSyntheticEvent = BaseSyntheticEvent & {|
37 _reactName: string,
38 -};
39 -export type UnknownReactSyntheticEvent = BaseSyntheticEvent & {
38 +|};
39 +export type UnknownReactSyntheticEvent = BaseSyntheticEvent & {|
40 _reactName: null,
41 -};
41 +|};
42
43 export type ReactSyntheticEvent =
44 | KnownReactSyntheticEvent
packages/react-dom/src/events/SyntheticEvent.js
+3 -2
@@ -13,7 +13,8 @@ import assign from 'shared/assign';
13 import getEventCharCode from './getEventCharCode';
14
15 type EventInterfaceType = {
16 - [propName: string]: 0 | ((event: {[propName: string]: mixed}) => mixed),
16 + [propName: string]: 0 | ((event: {[propName: string]: mixed, ...}) => mixed),
17 + ...,
18 };
19
20 function functionThatReturnsTrue() {
@@ -44,7 +45,7 @@ function createSyntheticEvent(Interface: EventInterfaceType) {
45 reactName: string | null,
46 reactEventType: string,
47 targetInst: Fiber,
47 - nativeEvent: {[propName: string]: mixed},
48 + nativeEvent: {[propName: string]: mixed, ...},
49 nativeEventTarget: null | EventTarget,
50 ) {
51 this._reactName = reactName;
packages/react-dom/src/server/ReactDOMFizzServerBrowser.js
+2 -2
@@ -37,9 +37,9 @@ type Options = {|
37 |};
38
39 // TODO: Move to sub-classing ReadableStream.
40 -type ReactDOMServerReadableStream = ReadableStream & {
40 +type ReactDOMServerReadableStream = ReadableStream & {|
41 allReady: Promise<void>,
42 -};
42 +|};
43
44 function renderToReadableStream(
45 children: ReactNodeList,
packages/react-dom/src/server/ReactDOMLegacyServerBrowser.js
+2 -2
@@ -11,9 +11,9 @@ import type {ReactNodeList} from 'shared/ReactTypes';
11
12 import {version, renderToStringImpl} from './ReactDOMLegacyServerImpl';
13
14 -type ServerOptions = {
14 +type ServerOptions = {|
15 identifierPrefix?: string,
16 -};
16 +|};
17
18 function renderToString(
19 children: ReactNodeList,
packages/react-dom/src/server/ReactDOMLegacyServerImpl.js
+2 -2
@@ -23,9 +23,9 @@ import {
23 createRootFormatContext,
24 } from './ReactDOMServerLegacyFormatConfig';
25
26 -type ServerOptions = {
26 +type ServerOptions = {|
27 identifierPrefix?: string,
28 -};
28 +|};
29
30 function onError() {
31 // Non-fatal errors are ignored.
packages/react-dom/src/server/ReactDOMLegacyServerNode.js
+2 -2
@@ -15,9 +15,9 @@ import {
15 renderToStaticNodeStream,
16 } from './ReactDOMLegacyServerNodeStream';
17
18 -type ServerOptions = {
18 +type ServerOptions = {|
19 identifierPrefix?: string,
20 -};
20 +|};
21
22 function renderToString(
23 children: ReactNodeList,
packages/react-dom/src/server/ReactDOMLegacyServerNodeStream.js
+2 -2
@@ -25,9 +25,9 @@ import {
25
26 import {Readable} from 'stream';
27
28 -type ServerOptions = {
28 +type ServerOptions = {|
29 identifierPrefix?: string,
30 -};
30 +|};
31
32 class ReactMarkupReadableStream extends Readable {
33 request: Request;
packages/react-dom/src/server/ReactDOMServerFormatConfig.js
+4 -4
@@ -105,10 +105,10 @@ const scriptRegex = /(<\/|<)(s)(cript)/gi;
105 const scriptReplacer = (match, prefix, s, suffix) =>
106 `${prefix}${s === 's' ? '\\u0073' : '\\u0053'}${suffix}`;
107
108 -export type BootstrapScriptDescriptor = {
108 +export type BootstrapScriptDescriptor = {|
109 src: string,
110 integrity?: string,
111 -};
111 +|};
112 // Allows us to keep track of what we've already written so we can refer back to it.
113 export function createResponseState(
114 identifierPrefix: string | void,
@@ -203,10 +203,10 @@ const HTML_COLGROUP_MODE = 7;
203 type InsertionMode = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
204
205 // Lets us keep track of contextual state and pick it back up after suspending.
206 -export type FormatContext = {
206 +export type FormatContext = {|
207 insertionMode: InsertionMode, // root/svg/html/mathml/table
208 selectedValue: null | string | Array<string>, // the selected value(s) inside a <select>, or null outside <select>
209 -};
209 +|};
210
211 function createFormatContext(
212 insertionMode: InsertionMode,
packages/react-dom/src/server/ReactDOMServerLegacyFormatConfig.js
+2 -2
@@ -28,7 +28,7 @@ import type {
28
29 export const isPrimaryRenderer = false;
30
31 -export type ResponseState = {
31 +export type ResponseState = {|
32 // Keep this in sync with ReactDOMServerFormatConfig
33 bootstrapChunks: Array<Chunk | PrecomputedChunk>,
34 startInlineScript: PrecomputedChunk,
@@ -42,7 +42,7 @@ export type ResponseState = {
42 sentClientRenderFunction: boolean,
43 // This is an extra field for the legacy renderer
44 generateStaticMarkup: boolean,
45 -};
45 +|};
46
47 export function createResponseState(
48 generateStaticMarkup: boolean,
packages/react-fs/src/ReactFilesystem.js
+7 -7
@@ -128,7 +128,7 @@ function createLstatMap(): Map<string, Array<boolean | Record<mixed>>> {
128 return new Map();
129 }
130
131 -export function lstat(path: string, options?: {bigint?: boolean}): mixed {
131 +export function lstat(path: string, options?: {|bigint?: boolean|}): mixed {
132 checkPathInDev(path);
133 let bigint = false;
134 if (options && options.bigint) {
@@ -167,7 +167,7 @@ function createReaddirMap(): Map<
167
168 export function readdir(
169 path: string,
170 - options?: string | {encoding?: string, withFileTypes?: boolean},
170 + options?: string | {|encoding?: string, withFileTypes?: boolean|},
171 ): mixed {
172 checkPathInDev(path);
173 let encoding = 'utf8';
@@ -215,12 +215,12 @@ export function readFile(
215 path: string,
216 options:
217 | string
218 - | {
218 + | {|
219 encoding?: string | null,
220 // Unsupported:
221 flag?: string, // Doesn't make sense except "r"
222 signal?: mixed, // We'll have our own signal
223 - },
223 + |},
224 ): string | Buffer {
225 checkPathInDev(path);
226 const map = unstable_getCacheForType(createReadFileMap);
@@ -270,7 +270,7 @@ function createReadlinkMap(): Map<string, Array<string | Record<mixed>>> {
270
271 export function readlink(
272 path: string,
273 - options?: string | {encoding?: string},
273 + options?: string | {|encoding?: string|},
274 ): mixed {
275 checkPathInDev(path);
276 let encoding = 'utf8';
@@ -311,7 +311,7 @@ function createRealpathMap(): Map<string, Array<string | Record<mixed>>> {
311
312 export function realpath(
313 path: string,
314 - options?: string | {encoding?: string},
314 + options?: string | {|encoding?: string|},
315 ): mixed {
316 checkPathInDev(path);
317 let encoding = 'utf8';
@@ -350,7 +350,7 @@ function createStatMap(): Map<string, Array<boolean | Record<mixed>>> {
350 return new Map();
351 }
352
353 -export function stat(path: string, options?: {bigint?: boolean}): mixed {
353 +export function stat(path: string, options?: {|bigint?: boolean|}): mixed {
354 checkPathInDev(path);
355 let bigint = false;
356 if (options && options.bigint) {
packages/react-interactions/events/src/dom/create-event-handle/Focus.js
+14 -12
@@ -14,15 +14,15 @@ const {useCallback, useEffect, useLayoutEffect, useRef} = React;
14
15 type FocusEvent = SyntheticEvent<EventTarget>;
16
17 -type UseFocusOptions = {
17 +type UseFocusOptions = {|
18 disabled?: boolean,
19 onBlur?: ?(FocusEvent) => void,
20 onFocus?: ?(FocusEvent) => void,
21 onFocusChange?: ?(boolean) => void,
22 onFocusVisibleChange?: ?(boolean) => void,
23 -};
23 +|};
24
25 -type UseFocusWithinOptions = {
25 +type UseFocusWithinOptions = {|
26 disabled?: boolean,
27 onAfterBlurWithin?: FocusEvent => void,
28 onBeforeBlurWithin?: FocusEvent => void,
@@ -30,7 +30,7 @@ type UseFocusWithinOptions = {
30 onFocusWithin?: FocusEvent => void,
31 onFocusWithinChange?: boolean => void,
32 onFocusWithinVisibleChange?: boolean => void,
33 -};
33 +|};
34
35 const isMac =
36 typeof window !== 'undefined' && window.navigator != null
@@ -154,7 +154,7 @@ function useFocusLifecycles() {
154 }
155
156 export function useFocus(
157 - focusTargetRef: {current: null | Node},
157 + focusTargetRef: {|current: null | Node|},
158 {
159 disabled,
160 onBlur,
@@ -164,9 +164,10 @@ export function useFocus(
164 }: UseFocusOptions,
165 ): void {
166 // Setup controlled state for this useFocus hook
167 - const stateRef = useRef<null | {isFocused: boolean, isFocusVisible: boolean}>(
168 - {isFocused: false, isFocusVisible: false},
169 - );
167 + const stateRef = useRef<null | {|
168 + isFocused: boolean,
169 + isFocusVisible: boolean,
170 + |}>({isFocused: false, isFocusVisible: false});
171 const focusHandle = useEvent('focusin');
172 const blurHandle = useEvent('focusout');
173 const focusVisibleHandles = useFocusVisibleInputHandles();
@@ -248,7 +249,7 @@ export function useFocus(
249
250 export function useFocusWithin<T>(
251 focusWithinTargetRef:
251 - | {current: null | T}
252 + | {|current: null | T|}
253 | ((focusWithinTarget: null | T) => void),
254 {
255 disabled,
@@ -261,9 +262,10 @@ export function useFocusWithin<T>(
262 }: UseFocusWithinOptions,
263 ): (focusWithinTarget: null | T) => void {
264 // Setup controlled state for this useFocus hook
264 - const stateRef = useRef<null | {isFocused: boolean, isFocusVisible: boolean}>(
265 - {isFocused: false, isFocusVisible: false},
266 - );
265 + const stateRef = useRef<null | {|
266 + isFocused: boolean,
267 + isFocusVisible: boolean,
268 + |}>({isFocused: false, isFocusVisible: false});
269 const focusHandle = useEvent('focusin');
270 const blurHandle = useEvent('focusout');
271 const afterBlurHandle = useEvent('afterblur');
packages/react-native-renderer/src/ReactFabricHostConfig.js
+4 -2
@@ -108,13 +108,13 @@ export type EventListenerRemoveOptions = $ReadOnly<{|
108 // TODO?: this will be changed in the future to be w3c-compatible and allow "EventListener" objects as well as functions.
109 export type EventListener = Function;
110
111 -type InternalEventListeners = {
111 +type InternalEventListeners = {|
112 [string]: {|
113 listener: EventListener,
114 options: EventListenerOptions,
115 invalidated: boolean,
116 |}[],
117 -};
117 +|};
118
119 // TODO: Remove this conditional once all changes have propagated.
120 if (registerEventHandler) {
@@ -255,6 +255,8 @@ class ReactFabricHostComponent {
255 const passive = optionsObj.passive || false;
256 const signal = null; // TODO: implement signal/AbortSignal
257
258 + /* $FlowFixMe the old version of Flow doesn't have a good way to define an
259 + * empty exact object. */
260 const eventListeners: InternalEventListeners = this._eventListeners || {};
261 if (this._eventListeners == null) {
262 this._eventListeners = eventListeners;
packages/react-native-renderer/src/ReactNativeTypes.js
+10 -10
@@ -62,38 +62,38 @@ export type PartialAttributeConfiguration = $ReadOnly<{
62 ...
63 }>;
64
65 -export type ViewConfig = $ReadOnly<{
65 +export type ViewConfig = $ReadOnly<{|
66 Commands?: $ReadOnly<{[commandName: string]: number, ...}>,
67 Constants?: $ReadOnly<{[name: string]: mixed, ...}>,
68 Manager?: string,
69 NativeProps?: $ReadOnly<{[propName: string]: string, ...}>,
70 baseModuleName?: ?string,
71 bubblingEventTypes?: $ReadOnly<{
72 - [eventName: string]: $ReadOnly<{
73 - phasedRegistrationNames: $ReadOnly<{
72 + [eventName: string]: $ReadOnly<{|
73 + phasedRegistrationNames: $ReadOnly<{|
74 captured: string,
75 bubbled: string,
76 skipBubbling?: ?boolean,
77 - }>,
78 - }>,
77 + |}>,
78 + |}>,
79 ...,
80 }>,
81 directEventTypes?: $ReadOnly<{
82 - [eventName: string]: $ReadOnly<{
82 + [eventName: string]: $ReadOnly<{|
83 registrationName: string,
84 - }>,
84 + |}>,
85 ...,
86 }>,
87 uiViewClassName: string,
88 validAttributes: AttributeConfiguration,
89 -}>;
89 +|}>;
90
91 -export type PartialViewConfig = $ReadOnly<{
91 +export type PartialViewConfig = $ReadOnly<{|
92 bubblingEventTypes?: $PropertyType<ViewConfig, 'bubblingEventTypes'>,
93 directEventTypes?: $PropertyType<ViewConfig, 'directEventTypes'>,
94 uiViewClassName: string,
95 validAttributes?: PartialAttributeConfiguration,
96 -}>;
96 +|}>;
97
98 export type NativeMethods = $ReadOnly<{|
99 blur(): void,
packages/react-native-renderer/src/legacy-events/PluginModuleType.js
+2 -2
@@ -22,7 +22,7 @@ export type PluginName = string;
22
23 export type EventSystemFlags = number;
24
25 -export type LegacyPluginModule<NativeEvent> = {
25 +export type LegacyPluginModule<NativeEvent> = {|
26 eventTypes: EventTypes,
27 extractEvents: (
28 topLevelType: TopLevelType,
@@ -33,4 +33,4 @@ export type LegacyPluginModule<NativeEvent> = {
33 container?: null | EventTarget,
34 ) => ?ReactSyntheticEvent,
35 tapMoveThreshold?: number,
36 -};
36 +|};
packages/react-native-renderer/src/server/ReactNativeServerFormatConfig.js
+2 -2
@@ -58,9 +58,9 @@ const SUSPENSE_UPDATE_TO_CLIENT_RENDER = new Uint8Array(1);
58 SUSPENSE_UPDATE_TO_CLIENT_RENDER[0] = SUSPENSE_UPDATE_TO_CLIENT_RENDER_TAG;
59
60 // Per response,
61 -export type ResponseState = {
61 +export type ResponseState = {|
62 nextSuspenseID: number,
63 -};
63 +|};
64
65 // Allows us to keep track of what we've already written so we can refer back to it.
66 export function createResponseState(): ResponseState {
packages/react-reconciler/src/ReactFiberConcurrentUpdates.new.js
+4 -4
@@ -33,14 +33,14 @@ import {NoFlags, Placement, Hydrating} from './ReactFiberFlags';
33 import {HostRoot, OffscreenComponent} from './ReactWorkTags';
34 import {OffscreenVisible} from './ReactFiberOffscreenComponent';
35
36 -export type ConcurrentUpdate = {
36 +export type ConcurrentUpdate = {|
37 next: ConcurrentUpdate,
38 lane: Lane,
39 -};
39 +|};
40
41 -type ConcurrentQueue = {
41 +type ConcurrentQueue = {|
42 pending: ConcurrentUpdate | null,
43 -};
43 +|};
44
45 // If a render is in progress, and we receive an update from a concurrent event,
46 // we wait until the current render is over (either finished or interrupted)
packages/react-reconciler/src/ReactFiberConcurrentUpdates.old.js
+4 -4
@@ -33,14 +33,14 @@ import {NoFlags, Placement, Hydrating} from './ReactFiberFlags';
33 import {HostRoot, OffscreenComponent} from './ReactWorkTags';
34 import {OffscreenVisible} from './ReactFiberOffscreenComponent';
35
36 -export type ConcurrentUpdate = {
36 +export type ConcurrentUpdate = {|
37 next: ConcurrentUpdate,
38 lane: Lane,
39 -};
39 +|};
40
41 -type ConcurrentQueue = {
41 +type ConcurrentQueue = {|
42 pending: ConcurrentUpdate | null,
43 -};
43 +|};
44
45 // If a render is in progress, and we receive an update from a concurrent event,
46 // we wait until the current render is over (either finished or interrupted)
packages/react-reconciler/src/ReactFiberHiddenContext.new.js
+1
@@ -22,6 +22,7 @@ type HiddenContext = {
22 // order to reveal the hidden content.
23 // TODO: Remove `subtreeLanes` context from work loop in favor of this one.
24 baseLanes: number,
25 + ...
26 };
27
28 // TODO: This isn't being used yet, but it's intended to replace the
packages/react-reconciler/src/ReactFiberHiddenContext.old.js
+1
@@ -22,6 +22,7 @@ type HiddenContext = {
22 // order to reveal the hidden content.
23 // TODO: Remove `subtreeLanes` context from work loop in favor of this one.
24 baseLanes: number,
25 + ...
26 };
27
28 // TODO: This isn't being used yet, but it's intended to replace the
packages/react-reconciler/src/ReactFiberHooks.new.js
+2 -2
@@ -1032,10 +1032,10 @@ function rerenderReducer<S, I, A>(
1032 }
1033
1034 type MutableSourceMemoizedState<Source, Snapshot> = {|
1035 - refs: {
1035 + refs: {|
1036 getSnapshot: MutableSourceGetSnapshotFn<Source, Snapshot>,
1037 setSnapshot: Snapshot => void,
1038 - },
1038 + |},
1039 source: MutableSource<any>,
1040 subscribe: MutableSourceSubscribeFn<Source, Snapshot>,
1041 |};
packages/react-reconciler/src/ReactFiberHooks.old.js
+2 -2
@@ -1032,10 +1032,10 @@ function rerenderReducer<S, I, A>(
1032 }
1033
1034 type MutableSourceMemoizedState<Source, Snapshot> = {|
1035 - refs: {
1035 + refs: {|
1036 getSnapshot: MutableSourceGetSnapshotFn<Source, Snapshot>,
1037 setSnapshot: Snapshot => void,
1038 - },
1038 + |},
1039 source: MutableSource<any>,
1040 subscribe: MutableSourceSubscribeFn<Source, Snapshot>,
1041 |};
packages/react-reconciler/src/ReactFiberRoot.new.js
+2 -2
@@ -38,11 +38,11 @@ import {initializeUpdateQueue} from './ReactFiberClassUpdateQueue.new';
38 import {LegacyRoot, ConcurrentRoot} from './ReactRootTags';
39 import {createCache, retainCache} from './ReactFiberCacheComponent.new';
40
41 -export type RootState = {
41 +export type RootState = {|
42 element: any,
43 isDehydrated: boolean,
44 cache: Cache,
45 -};
45 +|};
46
47 function FiberRootNode(
48 containerInfo,
packages/react-reconciler/src/ReactFiberRoot.old.js
+2 -2
@@ -38,11 +38,11 @@ import {initializeUpdateQueue} from './ReactFiberClassUpdateQueue.old';
38 import {LegacyRoot, ConcurrentRoot} from './ReactRootTags';
39 import {createCache, retainCache} from './ReactFiberCacheComponent.old';
40
41 -export type RootState = {
41 +export type RootState = {|
42 element: any,
43 isDehydrated: boolean,
44 cache: Cache,
45 -};
45 +|};
46
47 function FiberRootNode(
48 containerInfo,
packages/react-reconciler/src/ReactFiberTracingMarkerComponent.new.js
+9 -9
@@ -19,33 +19,33 @@ import {enableTransitionTracing} from 'shared/ReactFeatureFlags';
19 import {createCursor, push, pop} from './ReactFiberStack.new';
20 import {getWorkInProgressTransitions} from './ReactFiberWorkLoop.new';
21
22 -export type SuspenseInfo = {name: string | null};
22 +export type SuspenseInfo = {|name: string | null|};
23
24 -export type PendingTransitionCallbacks = {
24 +export type PendingTransitionCallbacks = {|
25 transitionStart: Array<Transition> | null,
26 transitionProgress: Map<Transition, PendingBoundaries> | null,
27 transitionComplete: Array<Transition> | null,
28 markerProgress: Map<
29 string,
30 - {pendingBoundaries: PendingBoundaries, transitions: Set<Transition>},
30 + {|pendingBoundaries: PendingBoundaries, transitions: Set<Transition>|},
31 > | null,
32 markerIncomplete: Map<
33 string,
34 - {aborts: Array<TransitionAbort>, transitions: Set<Transition>},
34 + {|aborts: Array<TransitionAbort>, transitions: Set<Transition>|},
35 > | null,
36 markerComplete: Map<string, Set<Transition>> | null,
37 -};
37 +|};
38
39 -export type Transition = {
39 +export type Transition = {|
40 name: string,
41 startTime: number,
42 -};
42 +|};
43
44 -export type BatchConfigTransition = {
44 +export type BatchConfigTransition = {|
45 name?: string,
46 startTime?: number,
47 _updatedFibers?: Set<Fiber>,
48 -};
48 +|};
49
50 // TODO: Is there a way to not include the tag or name here?
51 export type TracingMarkerInstance = {|
packages/react-reconciler/src/ReactFiberTracingMarkerComponent.old.js
+9 -9
@@ -19,33 +19,33 @@ import {enableTransitionTracing} from 'shared/ReactFeatureFlags';
19 import {createCursor, push, pop} from './ReactFiberStack.old';
20 import {getWorkInProgressTransitions} from './ReactFiberWorkLoop.old';
21
22 -export type SuspenseInfo = {name: string | null};
22 +export type SuspenseInfo = {|name: string | null|};
23
24 -export type PendingTransitionCallbacks = {
24 +export type PendingTransitionCallbacks = {|
25 transitionStart: Array<Transition> | null,
26 transitionProgress: Map<Transition, PendingBoundaries> | null,
27 transitionComplete: Array<Transition> | null,
28 markerProgress: Map<
29 string,
30 - {pendingBoundaries: PendingBoundaries, transitions: Set<Transition>},
30 + {|pendingBoundaries: PendingBoundaries, transitions: Set<Transition>|},
31 > | null,
32 markerIncomplete: Map<
33 string,
34 - {aborts: Array<TransitionAbort>, transitions: Set<Transition>},
34 + {|aborts: Array<TransitionAbort>, transitions: Set<Transition>|},
35 > | null,
36 markerComplete: Map<string, Set<Transition>> | null,
37 -};
37 +|};
38
39 -export type Transition = {
39 +export type Transition = {|
40 name: string,
41 startTime: number,
42 -};
42 +|};
43
44 -export type BatchConfigTransition = {
44 +export type BatchConfigTransition = {|
45 name?: string,
46 startTime?: number,
47 _updatedFibers?: Set<Fiber>,
48 -};
48 +|};
49
50 // TODO: Is there a way to not include the tag or name here?
51 export type TracingMarkerInstance = {|
packages/react-reconciler/src/ReactFiberTreeContext.new.js
+2 -2
@@ -64,10 +64,10 @@ import {getIsHydrating} from './ReactFiberHydrationContext.new';
64 import {clz32} from './clz32';
65 import {Forked, NoFlags} from './ReactFiberFlags';
66
67 -export type TreeContext = {
67 +export type TreeContext = {|
68 id: number,
69 overflow: string,
70 -};
70 +|};
71
72 // TODO: Use the unified fiber stack module instead of this local one?
73 // Intentionally not using it yet to derisk the initial implementation, because
packages/react-reconciler/src/ReactFiberTreeContext.old.js
+2 -2
@@ -64,10 +64,10 @@ import {getIsHydrating} from './ReactFiberHydrationContext.old';
64 import {clz32} from './clz32';
65 import {Forked, NoFlags} from './ReactFiberFlags';
66
67 -export type TreeContext = {
67 +export type TreeContext = {|
68 id: number,
69 overflow: string,
70 -};
70 +|};
71
72 // TODO: Use the unified fiber stack module instead of this local one?
73 // Intentionally not using it yet to derisk the initial implementation, because
packages/react-reconciler/src/ReactInternalTypes.js
+9 -9
@@ -258,7 +258,7 @@ type BaseFiberRootProperties = {|
258
259 onRecoverableError: (
260 error: mixed,
261 - errorInfo: {digest?: ?string, componentStack?: ?string},
261 + errorInfo: {|digest?: ?string, componentStack?: ?string|},
262 ) => void,
263 |};
264
@@ -280,22 +280,22 @@ type SuspenseCallbackOnlyFiberRootProperties = {|
280 hydrationCallbacks: null | SuspenseHydrationCallbacks,
281 |};
282
283 -export type TransitionTracingCallbacks = {
283 +export type TransitionTracingCallbacks = {|
284 onTransitionStart?: (transitionName: string, startTime: number) => void,
285 onTransitionProgress?: (
286 transitionName: string,
287 startTime: number,
288 currentTime: number,
289 - pending: Array<{name: null | string}>,
289 + pending: Array<{|name: null | string|}>,
290 ) => void,
291 onTransitionIncomplete?: (
292 transitionName: string,
293 startTime: number,
294 - deletions: Array<{
294 + deletions: Array<{|
295 type: string,
296 name?: string | null,
297 endTime: number,
298 - }>,
298 + |}>,
299 ) => void,
300 onTransitionComplete?: (
301 transitionName: string,
@@ -307,17 +307,17 @@ export type TransitionTracingCallbacks = {
307 marker: string,
308 startTime: number,
309 currentTime: number,
310 - pending: Array<{name: null | string}>,
310 + pending: Array<{|name: null | string|}>,
311 ) => void,
312 onMarkerIncomplete?: (
313 transitionName: string,
314 marker: string,
315 startTime: number,
316 - deletions: Array<{
316 + deletions: Array<{|
317 type: string,
318 name?: string | null,
319 endTime: number,
320 - }>,
320 + |}>,
321 ) => void,
322 onMarkerComplete?: (
323 transitionName: string,
@@ -325,7 +325,7 @@ export type TransitionTracingCallbacks = {
325 startTime: number,
326 endTime: number,
327 ) => void,
328 -};
328 +|};
329
330 // The following fields are only used in transition tracing in Profile builds
331 type TransitionTracingOnlyFiberRootProperties = {|
packages/react-reconciler/src/ReactTestSelectors.js
+4 -2
@@ -506,13 +506,15 @@ export function onCommitRoot(): void {
506 export type IntersectionObserverOptions = Object;
507
508 export type ObserveVisibleRectsCallback = (
509 - intersections: Array<{ratio: number, rect: BoundingRect}>,
509 + intersections: Array<{|ratio: number, rect: BoundingRect|}>,
510 ) => void;
511
512 export function observeVisibleRects(
513 hostRoot: Instance,
514 selectors: Array<Selector>,
515 - callback: (intersections: Array<{ratio: number, rect: BoundingRect}>) => void,
515 + callback: (
516 + intersections: Array<{|ratio: number, rect: BoundingRect|}>,
517 + ) => void,
518 options?: IntersectionObserverOptions,
519 ): {|disconnect: () => void|} {
520 if (!supportsTestSelectors) {
packages/react-server-dom-relay/src/ReactDOMServerFB.js
+4 -4
@@ -26,19 +26,19 @@ import {
26 createRootFormatContext,
27 } from 'react-server/src/ReactServerFormatConfig';
28
29 -type Options = {
29 +type Options = {|
30 identifierPrefix?: string,
31 bootstrapScriptContent?: string,
32 bootstrapScripts: Array<string>,
33 bootstrapModules: Array<string>,
34 progressiveChunkSize?: number,
35 onError: (error: mixed) => void,
36 -};
36 +|};
37
38 -opaque type Stream = {
38 +opaque type Stream = {|
39 destination: Destination,
40 request: Request,
41 -};
41 +|};
42
43 function renderToStream(children: ReactNodeList, options: Options): Stream {
44 const destination = {
packages/react-server-dom-relay/src/ReactFlightDOMRelayClient.js
+2
@@ -24,8 +24,10 @@ export {createResponse, close};
24
25 export function resolveRow(response: Response, chunk: RowEncoding): void {
26 if (chunk[0] === 'J') {
27 + // $FlowFixMe unable to refine on array indices
28 resolveModel(response, chunk[1], chunk[2]);
29 } else if (chunk[0] === 'M') {
30 + // $FlowFixMe unable to refine on array indices
31 resolveModule(response, chunk[1], chunk[2]);
32 } else if (chunk[0] === 'S') {
33 // $FlowFixMe: Flow doesn't support disjoint unions on tuples.
packages/react-server-dom-relay/src/ReactFlightDOMRelayProtocol.js
+2 -2
@@ -14,8 +14,8 @@ export type JSONValue =
14 | number
15 | boolean
16 | null
17 - | {+[key: string]: JSONValue}
18 - | Array<JSONValue>;
17 + | {|+[key: string]: JSONValue|}
18 + | $ReadOnlyArray<JSONValue>;
19
20 export type RowEncoding =
21 | ['J', number, JSONValue]
packages/react-server-dom-relay/src/ReactFlightDOMRelayServer.js
+2 -2
@@ -19,10 +19,10 @@ import {
19 startFlowing,
20 } from 'react-server/src/ReactFlightServer';
21
22 -type Options = {
22 +type Options = {|
23 onError?: (error: mixed) => void,
24 identifierPrefix?: string,
25 -};
25 +|};
26
27 function render(
28 model: ReactModel,
packages/react-server-dom-relay/src/ReactFlightDOMRelayServerHostConfig.js
+7 -2
@@ -78,7 +78,7 @@ export function processErrorChunk(
78
79 function convertModelToJSON(
80 request: Request,
81 - parent: {+[key: string]: ReactModel} | $ReadOnlyArray<ReactModel>,
81 + parent: {|+[key: string]: ReactModel|} | $ReadOnlyArray<ReactModel>,
82 key: string,
83 model: ReactModel,
84 ): JSONValue {
@@ -91,7 +91,9 @@ function convertModelToJSON(
91 }
92 return jsonArray;
93 } else {
94 - const jsonObj: {[key: string]: JSONValue} = {};
94 + /* $FlowFixMe the old version of Flow doesn't have a good way to define
95 + * an empty exact object. */
96 + const jsonObj: {|[key: string]: JSONValue|} = {};
97 for (const nextKey in json) {
98 if (hasOwnProperty.call(json, nextKey)) {
99 jsonObj[nextKey] = convertModelToJSON(
@@ -113,6 +115,7 @@ export function processModelChunk(
115 id: number,
116 model: ReactModel,
117 ): Chunk {
118 + // $FlowFixMe no good way to define an empty exact object
119 const json = convertModelToJSON(request, {}, '', model);
120 return ['J', id, json];
121 }
@@ -159,6 +162,7 @@ export function flushBuffered(destination: Destination) {}
162 export function beginWriting(destination: Destination) {}
163
164 export function writeChunk(destination: Destination, chunk: Chunk): void {
165 + // $FlowFixMe `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
166 emitRow(destination, chunk);
167 }
168
@@ -166,6 +170,7 @@ export function writeChunkAndReturn(
170 destination: Destination,
171 chunk: Chunk,
172 ): boolean {
173 + // $FlowFixMe `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
174 emitRow(destination, chunk);
175 return true;
176 }
packages/react-server-dom-relay/src/ReactServerStreamConfigFB.js
+2 -2
@@ -7,12 +7,12 @@
7 * @flow
8 */
9
10 -export type Destination = {
10 +export type Destination = {|
11 buffer: string,
12 done: boolean,
13 fatal: boolean,
14 error: mixed,
15 -};
15 +|};
16
17 export type PrecomputedChunk = string;
18 export type Chunk = string;
packages/react-server-dom-webpack/src/ReactFlightClientWebpackBundlerConfig.js
+6 -6
@@ -9,20 +9,20 @@
9
10 import type {Thenable} from 'shared/ReactTypes';
11
12 -export type WebpackSSRMap = {
13 - [clientId: string]: {
12 +export type WebpackSSRMap = {|
13 + [clientId: string]: {|
14 [clientExportName: string]: ModuleMetaData,
15 - },
16 -};
15 + |},
16 +|};
17
18 export type BundlerConfig = null | WebpackSSRMap;
19
20 -export opaque type ModuleMetaData = {
20 +export opaque type ModuleMetaData = {|
21 id: string,
22 chunks: Array<string>,
23 name: string,
24 async: boolean,
25 -};
25 +|};
26
27 // eslint-disable-next-line no-unused-vars
28 export opaque type ModuleReference<T> = ModuleMetaData;
packages/react-server-dom-webpack/src/ReactFlightDOMClient.js
+2 -2
@@ -19,9 +19,9 @@ import {
19 close,
20 } from 'react-client/src/ReactFlightClientStream';
21
22 -export type Options = {
22 +export type Options = {|
23 moduleMap?: BundlerConfig,
24 -};
24 +|};
25
26 function startReadingFromStream(
27 response: FlightResponse,
packages/react-server-dom-webpack/src/ReactFlightDOMServerBrowser.js
+2 -2
@@ -18,12 +18,12 @@ import {
18 abort,
19 } from 'react-server/src/ReactFlightServer';
20
21 -type Options = {
21 +type Options = {|
22 identifierPrefix?: string,
23 signal?: AbortSignal,
24 context?: Array<[string, ServerContextJSONValue]>,
25 onError?: (error: mixed) => void,
26 -};
26 +|};
27
28 function renderToReadableStream(
29 model: ReactModel,
packages/react-server-dom-webpack/src/ReactFlightDOMServerNode.js
+2 -2
@@ -23,11 +23,11 @@ function createDrainHandler(destination, request) {
23 return () => startFlowing(request, destination);
24 }
25
26 -type Options = {
26 +type Options = {|
27 onError?: (error: mixed) => void,
28 context?: Array<[string, ServerContextJSONValue]>,
29 identifierPrefix?: string,
30 -};
30 +|};
31
32 type PipeableStream = {|
33 abort(reason: mixed): void,
packages/react-server-dom-webpack/src/ReactFlightServerWebpackBundlerConfig.js
+8 -8
@@ -7,28 +7,28 @@
7 * @flow
8 */
9
10 -type WebpackMap = {
11 - [filepath: string]: {
10 +type WebpackMap = {|
11 + [filepath: string]: {|
12 [name: string]: ModuleMetaData,
13 - },
14 -};
13 + |},
14 +|};
15
16 export type BundlerConfig = WebpackMap;
17
18 // eslint-disable-next-line no-unused-vars
19 -export type ModuleReference<T> = {
19 +export type ModuleReference<T> = {|
20 $$typeof: symbol,
21 filepath: string,
22 name: string,
23 async: boolean,
24 -};
24 +|};
25
26 -export type ModuleMetaData = {
26 +export type ModuleMetaData = {|
27 id: string,
28 chunks: Array<string>,
29 name: string,
30 async: boolean,
31 -};
31 +|};
32
33 export type ModuleKey = string;
34
packages/react-server-dom-webpack/src/ReactFlightWebpackNodeLoader.js
+13 -13
@@ -9,37 +9,37 @@
9
10 import {acorn} from 'acorn';
11
12 -type ResolveContext = {
12 +type ResolveContext = {|
13 conditions: Array<string>,
14 parentURL: string | void,
15 -};
15 +|};
16
17 type ResolveFunction = (
18 string,
19 ResolveContext,
20 ResolveFunction,
21 -) => {url: string} | Promise<{url: string}>;
21 +) => {|url: string|} | Promise<{|url: string|}>;
22
23 -type GetSourceContext = {
23 +type GetSourceContext = {|
24 format: string,
25 -};
25 +|};
26
27 type GetSourceFunction = (
28 string,
29 GetSourceContext,
30 GetSourceFunction,
31 -) => Promise<{source: Source}>;
31 +) => Promise<{|source: Source|}>;
32
33 -type TransformSourceContext = {
33 +type TransformSourceContext = {|
34 format: string,
35 url: string,
36 -};
36 +|};
37
38 type TransformSourceFunction = (
39 Source,
40 TransformSourceContext,
41 TransformSourceFunction,
42 -) => Promise<{source: Source}>;
42 +) => Promise<{|source: Source|}>;
43
44 type Source = string | ArrayBuffer | Uint8Array;
45
@@ -52,7 +52,7 @@ export async function resolve(
52 specifier: string,
53 context: ResolveContext,
54 defaultResolve: ResolveFunction,
55 -): Promise<{url: string}> {
55 +): Promise<{|url: string|}> {
56 // We stash this in case we end up needing to resolve export * statements later.
57 stashedResolve = defaultResolve;
58
@@ -133,7 +133,7 @@ function addExportNames(names, node) {
133 function resolveClientImport(
134 specifier: string,
135 parentURL: string,
136 -): {url: string} | Promise<{url: string}> {
136 +): {|url: string|} | Promise<{|url: string|}> {
137 // Resolve an import specifier as if it was loaded by the client. This doesn't use
138 // the overrides that this loader does but instead reverts to the default.
139 // This resolution algorithm will not necessarily have the same configuration
@@ -151,7 +151,7 @@ function resolveClientImport(
151 async function loadClientImport(
152 url: string,
153 defaultTransformSource: TransformSourceFunction,
154 -): Promise<{source: Source}> {
154 +): Promise<{|source: Source|}> {
155 if (stashedGetSource === null) {
156 throw new Error(
157 'Expected getSource to have been called before transformSource',
@@ -225,7 +225,7 @@ export async function transformSource(
225 source: Source,
226 context: TransformSourceContext,
227 defaultTransformSource: TransformSourceFunction,
228 -): Promise<{source: Source}> {
228 +): Promise<{|source: Source|}> {
229 const transformed = await defaultTransformSource(
230 source,
231 context,
packages/react-server-dom-webpack/src/ReactFlightWebpackNodeRegister.js
+2 -2
@@ -52,7 +52,7 @@ module.exports = function register() {
52 // we should resolve that with a client reference that unwraps the Promise on
53 // the client.
54 const then = function then(resolve, reject) {
55 - const moduleReference: {[string]: any} = {
55 + const moduleReference: {[string]: any, ...} = {
56 $$typeof: MODULE_REFERENCE,
57 filepath: target.filepath,
58 name: '*', // Represents the whole object instead of a particular import.
@@ -93,7 +93,7 @@ module.exports = function register() {
93
94 Module._extensions['.client.js'] = function(module, path) {
95 const moduleId = url.pathToFileURL(path).href;
96 - const moduleReference: {[string]: any} = {
96 + const moduleReference: {[string]: any, ...} = {
97 $$typeof: MODULE_REFERENCE,
98 filepath: moduleId,
99 name: '*', // Represents the whole object instead of a particular import.
packages/react-server-dom-webpack/src/ReactFlightWebpackPlugin.js
+4 -4
@@ -42,21 +42,21 @@ class ClientReferenceDependency extends ModuleDependency {
42 const clientImportName = 'react-server-dom-webpack';
43 const clientFileName = require.resolve('../');
44
45 -type ClientReferenceSearchPath = {
45 +type ClientReferenceSearchPath = {|
46 directory: string,
47 recursive?: boolean,
48 include: RegExp,
49 exclude?: RegExp,
50 -};
50 +|};
51
52 type ClientReferencePath = string | ClientReferenceSearchPath;
53
54 -type Options = {
54 +type Options = {|
55 isServer: boolean,
56 clientReferences?: ClientReferencePath | $ReadOnlyArray<ClientReferencePath>,
57 chunkName?: string,
58 manifestFilename?: string,
59 -};
59 +|};
60
61 const PLUGIN_NAME = 'React Server Plugin';
62
packages/react-server-native-relay/src/ReactFlightNativeRelayClient.js
+2
@@ -24,8 +24,10 @@ export {createResponse, close};
24
25 export function resolveRow(response: Response, chunk: RowEncoding): void {
26 if (chunk[0] === 'J') {
27 + // $FlowFixMe `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
28 resolveModel(response, chunk[1], chunk[2]);
29 } else if (chunk[0] === 'M') {
30 + // $FlowFixMe `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
31 resolveModule(response, chunk[1], chunk[2]);
32 } else if (chunk[0] === 'S') {
33 // $FlowFixMe: Flow doesn't support disjoint unions on tuples.
packages/react-server-native-relay/src/ReactFlightNativeRelayProtocol.js
+1 -1
@@ -14,7 +14,7 @@ export type JSONValue =
14 | number
15 | boolean
16 | null
17 - | {+[key: string]: JSONValue}
17 + | {|+[key: string]: JSONValue|}
18 | Array<JSONValue>;
19
20 export type RowEncoding =
packages/react-server-native-relay/src/ReactFlightNativeRelayServerHostConfig.js
+6 -2
@@ -75,7 +75,7 @@ export function processErrorChunk(
75
76 function convertModelToJSON(
77 request: Request,
78 - parent: {+[key: string]: ReactModel} | $ReadOnlyArray<ReactModel>,
78 + parent: {|+[key: string]: ReactModel|} | $ReadOnlyArray<ReactModel>,
79 key: string,
80 model: ReactModel,
81 ): JSONValue {
@@ -88,7 +88,8 @@ function convertModelToJSON(
88 }
89 return jsonArray;
90 } else {
91 - const jsonObj: {[key: string]: JSONValue} = {};
91 + // $FlowFixMe no good way to define an empty exact object
92 + const jsonObj: {|[key: string]: JSONValue|} = {};
93 for (const nextKey in json) {
94 if (hasOwnProperty.call(json, nextKey)) {
95 jsonObj[nextKey] = convertModelToJSON(
@@ -110,6 +111,7 @@ export function processModelChunk(
111 id: number,
112 model: ReactModel,
113 ): Chunk {
114 + // $FlowFixMe no good way to define an empty exact object
115 const json = convertModelToJSON(request, {}, '', model);
116 return ['J', id, json];
117 }
@@ -156,6 +158,7 @@ export function flushBuffered(destination: Destination) {}
158 export function beginWriting(destination: Destination) {}
159
160 export function writeChunk(destination: Destination, chunk: Chunk): void {
161 + // $FlowFixMe `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
162 emitRow(destination, chunk);
163 }
164
@@ -163,6 +166,7 @@ export function writeChunkAndReturn(
166 destination: Destination,
167 chunk: Chunk,
168 ): boolean {
169 + // $FlowFixMe `Chunk` doesn't flow into `JSONValue` because of the `E` row type.
170 emitRow(destination, chunk);
171 return true;
172 }
packages/react-server/src/ReactFizzClassComponent.js
+2 -2
@@ -100,10 +100,10 @@ function warnNoop(
100 }
101 }
102
103 -type InternalInstance = {
103 +type InternalInstance = {|
104 queue: null | Array<Object>,
105 replace: boolean,
106 -};
106 +|};
107
108 const classComponentUpdater = {
109 isMounted(inst) {
packages/react-server/src/ReactFizzComponentStack.js
+6 -6
@@ -14,21 +14,21 @@ import {
14 } from 'shared/ReactComponentStackFrame';
15
16 // DEV-only reverse linked list representing the current component stack
17 -type BuiltInComponentStackNode = {
17 +type BuiltInComponentStackNode = {|
18 tag: 0,
19 parent: null | ComponentStackNode,
20 type: string,
21 -};
22 -type FunctionComponentStackNode = {
21 +|};
22 +type FunctionComponentStackNode = {|
23 tag: 1,
24 parent: null | ComponentStackNode,
25 type: Function,
26 -};
27 -type ClassComponentStackNode = {
26 +|};
27 +type ClassComponentStackNode = {|
28 tag: 2,
29 parent: null | ComponentStackNode,
30 type: Function,
31 -};
31 +|};
32 export type ComponentStackNode =
33 | BuiltInComponentStackNode
34 | FunctionComponentStackNode
packages/react-server/src/ReactFizzNewContext.js
+2 -2
@@ -20,13 +20,13 @@ if (__DEV__) {
20
21 // Used to store the parent path of all context overrides in a shared linked list.
22 // Forming a reverse tree.
23 -type ContextNode<T> = {
23 +type ContextNode<T> = {|
24 parent: null | ContextNode<any>,
25 depth: number, // Short hand to compute the depth of the tree at this node.
26 context: ReactContext<T>,
27 parentValue: T,
28 value: T,
29 -};
29 +|};
30
31 // The structure of a context snapshot is an implementation of this file.
32 // Currently, it's implemented as tracking the current active node.
packages/react-server/src/ReactFizzServer.js
+10 -10
@@ -131,11 +131,11 @@ import {trackSuspendedWakeable} from './ReactFizzWakeable';
131 const ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
132 const ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
133
134 -type LegacyContext = {
134 +type LegacyContext = {|
135 [key: string]: any,
136 -};
136 +|};
137
138 -type SuspenseBoundary = {
138 +type SuspenseBoundary = {|
139 id: SuspenseBoundaryID,
140 rootSegmentID: number,
141 errorDigest: ?string, // the error hash if it errors
@@ -147,9 +147,9 @@ type SuspenseBoundary = {
147 completedSegments: Array<Segment>, // completed but not yet flushed segments.
148 byteSize: number, // used to determine whether to inline children boundaries.
149 fallbackAbortableTasks: Set<Task>, // used to cancel task on the fallback if the boundary completes or gets canceled.
150 -};
150 +|};
151
152 -export type Task = {
152 +export type Task = {|
153 node: ReactNodeList,
154 ping: () => void,
155 blockedBoundary: Root | SuspenseBoundary,
@@ -160,7 +160,7 @@ export type Task = {
160 treeContext: TreeContext, // the current tree context that this task is executing in
161 componentStack: null | ComponentStackNode, // DEV-only component stack
162 thenableState: null | ThenableState,
163 -};
163 +|};
164
165 const PENDING = 0;
166 const COMPLETED = 1;
@@ -170,7 +170,7 @@ const ERRORED = 4;
170
171 type Root = null;
172
173 -type Segment = {
173 +type Segment = {|
174 status: 0 | 1 | 2 | 3 | 4,
175 parentFlushed: boolean, // typically a segment will be flushed by its parent, except if its parent was already flushed
176 id: number, // starts as 0 and is lazily assigned if the parent flushes early
@@ -184,13 +184,13 @@ type Segment = {
184 // used to discern when text separator boundaries are needed
185 lastPushedText: boolean,
186 textEmbedded: boolean,
187 -};
187 +|};
188
189 const OPEN = 0;
190 const CLOSING = 1;
191 const CLOSED = 2;
192
193 -export opaque type Request = {
193 +export opaque type Request = {|
194 destination: null | Destination,
195 +responseState: ResponseState,
196 +progressiveChunkSize: number,
@@ -223,7 +223,7 @@ export opaque type Request = {
223 // emit a different response to the stream instead.
224 onShellError: (error: mixed) => void,
225 onFatalError: (error: mixed) => void,
226 -};
226 +|};
227
228 // This is a default heuristic for how to split up the HTML content into progressive
229 // loading. Our goal is to be able to display additional new content about every 500ms.
packages/react-server/src/ReactFizzTreeContext.js
+2 -2
@@ -60,10 +60,10 @@
60 // log2(32) = 5 bits. That means we can lop bits off the end 5 at a time without
61 // affecting the final result.
62
63 -export type TreeContext = {
63 +export type TreeContext = {|
64 +id: number,
65 +overflow: string,
66 -};
66 +|};
67
68 export const emptyTreeContext = {
69 id: 1,
packages/react-server/src/ReactFlightNewContext.js
+2 -2
@@ -23,13 +23,13 @@ if (__DEV__) {
23
24 // Used to store the parent path of all context overrides in a shared linked list.
25 // Forming a reverse tree.
26 -type ContextNode<T: ServerContextJSONValue> = {
26 +type ContextNode<T: ServerContextJSONValue> = {|
27 parent: null | ContextNode<any>,
28 depth: number, // Short hand to compute the depth of the tree at this node.
29 context: ReactServerContext<T>,
30 parentValue: T,
31 value: T,
32 -};
32 +|};
33
34 // The structure of a context snapshot is an implementation of this file.
35 // Currently, it's implemented as tracking the current active node.
packages/react-server/src/ReactFlightServer.js
+12 -9
@@ -91,23 +91,23 @@ export type ReactModel =
91 | Iterable<ReactModel>
92 | ReactModelObject;
93
94 -type ReactModelObject = {+[key: string]: ReactModel};
94 +type ReactModelObject = {|+[key: string]: ReactModel|};
95
96 const PENDING = 0;
97 const COMPLETED = 1;
98 const ABORTED = 3;
99 const ERRORED = 4;
100
101 -type Task = {
101 +type Task = {|
102 id: number,
103 status: 0 | 1 | 3 | 4,
104 model: ReactModel,
105 ping: () => void,
106 context: ContextSnapshot,
107 thenableState: ThenableState | null,
108 -};
108 +|};
109
110 -export type Request = {
110 +export type Request = {|
111 status: 0 | 1 | 2,
112 fatalError: mixed,
113 destination: null | Destination,
@@ -127,7 +127,7 @@ export type Request = {
127 identifierCount: number,
128 onError: (error: mixed) => void,
129 toJSON: (key: string, value: ReactModel) => ReactJSONValue,
130 -};
130 +|};
131
132 const ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
133
@@ -272,6 +272,7 @@ function attemptResolveElement(
272 );
273 }
274 }
275 + // $FlowFixMe issue discovered when updating Flow
276 return [
277 REACT_ELEMENT_TYPE,
278 type,
@@ -324,7 +325,7 @@ function serializeByRefID(id: number): string {
325
326 function serializeModuleReference(
327 request: Request,
327 - parent: {+[key: string | number]: ReactModel} | $ReadOnlyArray<ReactModel>,
328 + parent: {|+[key: string | number]: ReactModel|} | $ReadOnlyArray<ReactModel>,
329 key: string,
330 moduleReference: ModuleReference<any>,
331 ): string {
@@ -465,7 +466,7 @@ function describeValueForErrorMessage(value: ReactModel): string {
466
467 function describeObjectForErrorMessage(
468 objectOrArray:
468 - | {+[key: string | number]: ReactModel}
469 + | {+[key: string | number]: ReactModel, ...}
470 | $ReadOnlyArray<ReactModel>,
471 expandedName?: string,
472 ): string {
@@ -495,7 +496,7 @@ function describeObjectForErrorMessage(
496 return str;
497 } else {
498 let str = '{';
498 - const object: {+[key: string | number]: ReactModel} = objectOrArray;
499 + const object: {+[key: string | number]: ReactModel, ...} = objectOrArray;
500 const names = Object.keys(object);
501 for (let i = 0; i < names.length; i++) {
502 if (i > 0) {
@@ -528,7 +529,7 @@ let isInsideContextValue = false;
529
530 export function resolveModelToJSON(
531 request: Request,
531 - parent: {+[key: string | number]: ReactModel} | $ReadOnlyArray<ReactModel>,
532 + parent: {|+[key: string | number]: ReactModel|} | $ReadOnlyArray<ReactModel>,
533 key: string,
534 value: ReactModel,
535 ): ReactJSONValue {
@@ -698,6 +699,7 @@ export function resolveModelToJSON(
699 }
700 }
701
702 + // $FlowFixMe
703 return value;
704 }
705
@@ -839,6 +841,7 @@ function emitModuleChunk(
841 id: number,
842 moduleMetaData: ModuleMetaData,
843 ): void {
844 + // $FlowFixMe ModuleMetaData is not a ReactModel
845 const processedChunk = processModuleChunk(request, id, moduleMetaData);
846 request.completedModuleChunks.push(processedChunk);
847 }
packages/react/src/ReactChildren.js
+2 -2
@@ -173,9 +173,9 @@ function mapIntoArray(
173 } else {
174 const iteratorFn = getIteratorFn(children);
175 if (typeof iteratorFn === 'function') {
176 - const iterableChildren: Iterable<React$Node> & {
176 + const iterableChildren: Iterable<React$Node> & {|
177 entries: any,
178 - } = (children: any);
178 + |} = (children: any);
179
180 if (__DEV__) {
181 // Warn about using Maps as children
packages/react/src/ReactCurrentBatchConfig.js
+2 -2
@@ -9,9 +9,9 @@
9
10 import type {BatchConfigTransition} from 'react-reconciler/src/ReactFiberTracingMarkerComponent.new';
11
12 -type BatchConfig = {
12 +type BatchConfig = {|
13 transition: BatchConfigTransition | null,
14 -};
14 +|};
15 /**
16 * Keeps track of the current batch's configuration such as how long an update
17 * should suspend for if it needs to.
packages/react/src/ReactLazy.js
+11 -11
@@ -16,25 +16,25 @@ const Pending = 0;
16 const Resolved = 1;
17 const Rejected = 2;
18
19 -type UninitializedPayload<T> = {
19 +type UninitializedPayload<T> = {|
20 _status: -1,
21 _result: () => Thenable<{default: T, ...}>,
22 -};
22 +|};
23
24 -type PendingPayload = {
24 +type PendingPayload = {|
25 _status: 0,
26 _result: Wakeable,
27 -};
27 +|};
28
29 -type ResolvedPayload<T> = {
29 +type ResolvedPayload<T> = {|
30 _status: 1,
31 - _result: {default: T},
32 -};
31 + _result: {default: T, ...},
32 +|};
33
34 -type RejectedPayload = {
34 +type RejectedPayload = {|
35 _status: 2,
36 _result: mixed,
37 -};
37 +|};
38
39 type Payload<T> =
40 | UninitializedPayload<T>
@@ -42,11 +42,11 @@ type Payload<T> =
42 | ResolvedPayload<T>
43 | RejectedPayload;
44
45 -export type LazyComponent<T, P> = {
45 +export type LazyComponent<T, P> = {|
46 $$typeof: symbol | number,
47 _payload: P,
48 _init: (payload: P) => T,
49 -};
49 +|};
50
51 function lazyInitializer<T>(payload: Payload<T>): T {
52 if (payload._status === Uninitialized) {
packages/scheduler/src/forks/SchedulerPostTask.js
+1 -1
@@ -77,7 +77,7 @@ type SchedulerCallback<T> = (
77 export function unstable_scheduleCallback<T>(
78 priorityLevel: PriorityLevel,
79 callback: SchedulerCallback<T>,
80 - options?: {delay?: number},
80 + options?: {|delay?: number|},
81 ): CallbackNode {
82 let postTaskPriority;
83 switch (priorityLevel) {
packages/shared/ReactTypes.js
+3 -3
@@ -80,7 +80,7 @@ export type ServerContextJSONValue =
80 | number
81 | null
82 | $ReadOnlyArray<ServerContextJSONValue>
83 - | {+[key: string]: ServerContextJSONValue};
83 + | {|+[key: string]: ServerContextJSONValue|};
84
85 export type ReactServerContext<T: any> = ReactContext<T>;
86
@@ -209,9 +209,9 @@ export type OffscreenMode =
209 | 'unstable-defer-without-hiding'
210 | 'visible';
211
212 -export type StartTransitionOptions = {
212 +export type StartTransitionOptions = {|
213 name?: string,
214 -};
214 +|};
215
216 // TODO: Add Context support
217 export type Usable<T> = Thenable<T> | ReactContext<T>;
scripts/flow/config/flowconfig
+1
@@ -37,6 +37,7 @@
37
38 [lints]
39 untyped-type-import=error
40 +implicit-inexact-object=error
41
42 [options]
43 server.max_workers=4
scripts/flow/environment.js
+15 -15
@@ -77,52 +77,52 @@ declare module 'fs/promises' {
77 declare var access: (path: string, mode?: number) => Promise<void>;
78 declare var lstat: (
79 path: string,
80 - options?: ?{bigint?: boolean},
80 + options?: ?{|bigint?: boolean|},
81 ) => Promise<mixed>;
82 declare var readdir: (
83 path: string,
84 options?:
85 | ?string
86 - | {
86 + | {|
87 encoding?: ?string,
88 withFileTypes?: ?boolean,
89 - },
89 + |},
90 ) => Promise<Buffer>;
91 declare var readFile: (
92 path: string,
93 options?:
94 | ?string
95 - | {
95 + | {|
96 encoding?: ?string,
97 - },
97 + |},
98 ) => Promise<Buffer>;
99 declare var readlink: (
100 path: string,
101 options?:
102 | ?string
103 - | {
103 + | {|
104 encoding?: ?string,
105 - },
105 + |},
106 ) => Promise<mixed>;
107 declare var realpath: (
108 path: string,
109 options?:
110 | ?string
111 - | {
111 + | {|
112 encoding?: ?string,
113 - },
113 + |},
114 ) => Promise<mixed>;
115 declare var stat: (
116 path: string,
117 - options?: ?{bigint?: boolean},
117 + options?: ?{|bigint?: boolean|},
118 ) => Promise<mixed>;
119 }
120 declare module 'pg' {
121 declare var Pool: (
122 options: mixed,
123 - ) => {
123 + ) => {|
124 query: (query: string, values?: Array<mixed>) => void,
125 - };
125 + |};
126 }
127
128 declare module 'util' {
@@ -147,13 +147,13 @@ declare module 'util' {
147 encodeInto(
148 buffer: string,
149 dest: Uint8Array,
150 - ): {read: number, written: number};
150 + ): {|read: number, written: number|};
151 encoding: string;
152 }
153 }
154
155 declare module 'pg/lib/utils' {
156 - declare module.exports: {
156 + declare module.exports: {|
157 prepareValue(val: any): mixed,
158 - };
158 + |};
159 }
scripts/flow/react-native-host-hooks.js
+1 -1
@@ -26,7 +26,7 @@ type RawEventEmitterEvent = $ReadOnly<{|
26 // We expect, but do not/cannot require, that nativeEvent is an object
27 // with the properties: key, elementType (string), type (string), tag (numeric),
28 // and a stateNode of the native element/Fiber the event was emitted to.
29 - nativeEvent: {[string]: mixed},
29 + nativeEvent: {[string]: mixed, ...},
30 |}>;
31
32 declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface' {
scripts/flow/react-relay-hooks.js
+1 -1
@@ -12,7 +12,7 @@ type JSONValue =
12 | boolean
13 | number
14 | null
15 - | {+[key: string]: JSONValue}
15 + | {|+[key: string]: JSONValue|}
16 | $ReadOnlyArray<JSONValue>;
17
18 declare module 'JSResourceReference' {