From f498aa299292d4d1e999f66d1c769440ad10d57c Mon Sep 17 00:00:00 2001 From: Jan Kassens Date: Mon, 4 Dec 2023 16:10:36 -0500 Subject: [PATCH] Flow: make more objects exact (#27790) This makes a couple objects more exact. Nothing critical, just noticed this old branch I had created when doing some Flow upgrades in the past. --- packages/react-debug-tools/src/ReactDebugHooks.js | 2 -- packages/react-devtools-core/src/backend.js | 1 - packages/react-devtools-shared/src/devtools/cache.js | 1 - .../views/Components/NativeStyleEditor/AutoSizeInput.js | 1 - .../src/devtools/views/Components/OwnersStack.js | 1 - .../src/devtools/views/Profiler/CommitRankedListItem.js | 1 - packages/react-devtools-shared/src/hydration.js | 2 +- packages/react-dom/src/client/ReactDOMRoot.js | 4 +--- packages/shared/ReactTypes.js | 9 +-------- .../shims/react-native/ReactNativeViewConfigRegistry.js | 2 -- 10 files changed, 3 insertions(+), 21 deletions(-) diff --git a/packages/react-debug-tools/src/ReactDebugHooks.js b/packages/react-debug-tools/src/ReactDebugHooks.js index 7e2e2effb13a4..111041548259b 100644 --- a/packages/react-debug-tools/src/ReactDebugHooks.js +++ b/packages/react-debug-tools/src/ReactDebugHooks.js @@ -36,7 +36,6 @@ type HookLogEntry = { primitive: string, stackError: Error, value: mixed, - ... }; let hookLog: Array = []; @@ -408,7 +407,6 @@ export type HooksNode = { value: mixed, subHooks: Array, hookSource?: HookSource, - ... }; export type HooksTree = Array; diff --git a/packages/react-devtools-core/src/backend.js b/packages/react-devtools-core/src/backend.js index 72674a0a8cdd7..ee26ff35a4090 100644 --- a/packages/react-devtools-core/src/backend.js +++ b/packages/react-devtools-core/src/backend.js @@ -36,7 +36,6 @@ type ConnectOptions = { isAppActive?: () => boolean, websocket?: ?WebSocket, devToolsSettingsManager: ?DevToolsSettingsManager, - ... }; // Install a global variable to allow patching console early (during injection). diff --git a/packages/react-devtools-shared/src/devtools/cache.js b/packages/react-devtools-shared/src/devtools/cache.js index c8f62ba3853c3..4bb44bacb3a5b 100644 --- a/packages/react-devtools-shared/src/devtools/cache.js +++ b/packages/react-devtools-shared/src/devtools/cache.js @@ -53,7 +53,6 @@ export type Resource = { read(Input): Value, preload(Input): void, write(Key, Value): void, - ... }; const Pending = 0; diff --git a/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.js b/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.js index c69108db7b0e7..524e6d02ccf51 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.js @@ -16,7 +16,6 @@ type Props = { placeholder?: string, testName?: ?string, value: any, - ... }; export default function AutoSizeInput({ diff --git a/packages/react-devtools-shared/src/devtools/views/Components/OwnersStack.js b/packages/react-devtools-shared/src/devtools/views/Components/OwnersStack.js index d4e177e30ac5f..0486b55c69db4 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/OwnersStack.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/OwnersStack.js @@ -202,7 +202,6 @@ type ElementsDropdownProps = { owners: Array, selectedIndex: number, selectOwner: SelectOwner, - ... }; function ElementsDropdown({owners, selectOwner}: ElementsDropdownProps) { const store = useContext(StoreContext); diff --git a/packages/react-devtools-shared/src/devtools/views/Profiler/CommitRankedListItem.js b/packages/react-devtools-shared/src/devtools/views/Profiler/CommitRankedListItem.js index f1aafecb7eada..4a8ab9b7e6be2 100644 --- a/packages/react-devtools-shared/src/devtools/views/Profiler/CommitRankedListItem.js +++ b/packages/react-devtools-shared/src/devtools/views/Profiler/CommitRankedListItem.js @@ -21,7 +21,6 @@ type Props = { data: ItemData, index: number, style: Object, - ... }; function CommitRankedListItem({data, index, style}: Props) { diff --git a/packages/react-devtools-shared/src/hydration.js b/packages/react-devtools-shared/src/hydration.js index f9834fcb41e2a..6522076e7ddae 100644 --- a/packages/react-devtools-shared/src/hydration.js +++ b/packages/react-devtools-shared/src/hydration.js @@ -427,7 +427,7 @@ export function hydrate( parent[last] = undefined; } else { // Replace the string keys with Symbols so they're non-enumerable. - const replaced: {[key: symbol]: boolean | string, ...} = {}; + const replaced: {[key: symbol]: boolean | string} = {}; replaced[meta.inspectable] = !!value.inspectable; replaced[meta.inspected] = false; replaced[meta.name] = value.name; diff --git a/packages/react-dom/src/client/ReactDOMRoot.js b/packages/react-dom/src/client/ReactDOMRoot.js index 0e3579eb379ae..9b93ab6354bd0 100644 --- a/packages/react-dom/src/client/ReactDOMRoot.js +++ b/packages/react-dom/src/client/ReactDOMRoot.js @@ -35,15 +35,14 @@ export type RootType = { render(children: ReactNodeList): void, unmount(): void, _internalRoot: FiberRoot | null, - ... }; + export type CreateRootOptions = { unstable_strictMode?: boolean, unstable_concurrentUpdatesByDefault?: boolean, unstable_transitionCallbacks?: TransitionTracingCallbacks, identifierPrefix?: string, onRecoverableError?: (error: mixed) => void, - ... }; export type HydrateRootOptions = { @@ -57,7 +56,6 @@ export type HydrateRootOptions = { identifierPrefix?: string, onRecoverableError?: (error: mixed) => void, formState?: ReactFormState | null, - ... }; import { diff --git a/packages/shared/ReactTypes.js b/packages/shared/ReactTypes.js index db44433e69333..c4e790ce5d9ee 100644 --- a/packages/shared/ReactTypes.js +++ b/packages/shared/ReactTypes.js @@ -31,15 +31,12 @@ export type ReactProvider = { props: { value: T, children?: ReactNodeList, - ... }, - ... }; export type ReactProviderType = { $$typeof: symbol | number, _context: ReactContext, - ... }; export type ReactConsumer = { @@ -49,9 +46,7 @@ export type ReactConsumer = { ref: null, props: { children: (value: T) => ReactNodeList, - ... }, - ... }; export type ReactContext = { @@ -71,7 +66,6 @@ export type ReactContext = { // only used by ServerContext _defaultValue: T, _globalName: string, - ... }; export type ServerContextJSONValue = @@ -91,7 +85,6 @@ export type ReactPortal = { children: ReactNodeList, // TODO: figure out the API for cross-renderer implementation. implementation: any, - ... }; export type RefObject = { @@ -104,7 +97,7 @@ export type ReactScope = { export type ReactScopeQuery = ( type: string, - props: {[string]: mixed, ...}, + props: {[string]: mixed}, instance: mixed, ) => boolean; diff --git a/scripts/rollup/shims/react-native/ReactNativeViewConfigRegistry.js b/scripts/rollup/shims/react-native/ReactNativeViewConfigRegistry.js index 704099ec6b1fb..84a7082ea26e2 100644 --- a/scripts/rollup/shims/react-native/ReactNativeViewConfigRegistry.js +++ b/scripts/rollup/shims/react-native/ReactNativeViewConfigRegistry.js @@ -22,13 +22,11 @@ export const customBubblingEventTypes: { skipBubbling?: ?boolean, }>, }>, - ... } = {}; export const customDirectEventTypes: { [eventName: string]: $ReadOnly<{ registrationName: string, }>, - ... } = {}; const viewConfigCallbacks = new Map ViewConfig>();