diff --git a/packages/react-devtools-core/src/standalone.js b/packages/react-devtools-core/src/standalone.js index 4a2ba8ff08e67..315b6bcaf936e 100644 --- a/packages/react-devtools-core/src/standalone.js +++ b/packages/react-devtools-core/src/standalone.js @@ -57,7 +57,7 @@ function hookNamesModuleLoaderFunction() { ); } -function setContentDOMNode(value: HTMLElement) { +function setContentDOMNode(value: HTMLElement): typeof DevtoolsUI { node = value; // Save so we can restore the exact waiting message between sessions. @@ -70,12 +70,14 @@ function setProjectRoots(value: Array) { projectRoots = value; } -function setStatusListener(value: StatusListener) { +function setStatusListener(value: StatusListener): typeof DevtoolsUI { statusListener = value; return DevtoolsUI; } -function setDisconnectedCallback(value: OnDisconnectedCallback) { +function setDisconnectedCallback( + value: OnDisconnectedCallback, +): typeof DevtoolsUI { disconnectedCallback = value; return DevtoolsUI; } diff --git a/packages/react-is/src/ReactIs.js b/packages/react-is/src/ReactIs.js index 26bf7e3c6b36d..8d383485daa49 100644 --- a/packages/react-is/src/ReactIs.js +++ b/packages/react-is/src/ReactIs.js @@ -26,7 +26,7 @@ import { } from 'shared/ReactSymbols'; import isValidElementType from 'shared/isValidElementType'; -export function typeOf(object: any) { +export function typeOf(object: any): mixed { if (typeof object === 'object' && object !== null) { const $$typeof = object.$$typeof; switch ($$typeof) { diff --git a/packages/react-refresh/src/ReactFreshRuntime.js b/packages/react-refresh/src/ReactFreshRuntime.js index 56af77a8e8584..00e7932ec401e 100644 --- a/packages/react-refresh/src/ReactFreshRuntime.js +++ b/packages/react-refresh/src/ReactFreshRuntime.js @@ -637,7 +637,12 @@ export function _getMountedRootCount(): number { // 'useState{[foo, setFoo]}(0)', // () => [useCustomHook], /* Lazy to avoid triggering inline requires */ // ); -export function createSignatureFunctionForTransform() { +export function createSignatureFunctionForTransform(): ( + type: T, + key: string, + forceReset?: boolean, + getCustomHooks?: () => Array, +) => T | void { if (__DEV__) { let savedType; let hasCustomHooks; diff --git a/packages/react-server/src/ReactFlightHooks.js b/packages/react-server/src/ReactFlightHooks.js index c2d319074e7f8..aa6358efcd4dc 100644 --- a/packages/react-server/src/ReactFlightHooks.js +++ b/packages/react-server/src/ReactFlightHooks.js @@ -122,12 +122,14 @@ function unsupportedRefresh(): void { let currentCache: Map | null = null; -export function setCurrentCache(cache: Map | null) { +export function setCurrentCache( + cache: Map | null, +): Map | null { currentCache = cache; return currentCache; } -export function getCurrentCache() { +export function getCurrentCache(): Map | null { return currentCache; } diff --git a/packages/use-sync-external-store/src/useSyncExternalStoreShim.js b/packages/use-sync-external-store/src/useSyncExternalStoreShim.js index 82d944de1dd1d..73fcf26439010 100644 --- a/packages/use-sync-external-store/src/useSyncExternalStoreShim.js +++ b/packages/use-sync-external-store/src/useSyncExternalStoreShim.js @@ -14,5 +14,8 @@ import {useSyncExternalStore as builtInAPI} from 'react'; const shim = isServerEnvironment ? server : client; -export const useSyncExternalStore = - builtInAPI !== undefined ? ((builtInAPI: any): typeof shim) : shim; +export const useSyncExternalStore: ( + subscribe: (() => void) => () => void, + getSnapshot: () => T, + getServerSnapshot?: () => T, +) => T = builtInAPI !== undefined ? builtInAPI : shim; diff --git a/scripts/flow/config/flowconfig b/scripts/flow/config/flowconfig index d5330858f60c7..adc89ba407667 100644 --- a/scripts/flow/config/flowconfig +++ b/scripts/flow/config/flowconfig @@ -48,43 +48,43 @@ munge_underscores=false types_first=false well_formed_exports=true -; well_formed_exports.includes=/packages/dom-event-testing-library -; well_formed_exports.includes=/packages/eslint-plugin-react-hooks -; well_formed_exports.includes=/packages/jest-mock-scheduler -; well_formed_exports.includes=/packages/jest-react +well_formed_exports.includes=/packages/dom-event-testing-library +well_formed_exports.includes=/packages/eslint-plugin-react-hooks +well_formed_exports.includes=/packages/jest-mock-scheduler +well_formed_exports.includes=/packages/jest-react ; well_formed_exports.includes=/packages/react -; well_formed_exports.includes=/packages/react-art -; well_formed_exports.includes=/packages/react-cache -; well_formed_exports.includes=/packages/react-client -; well_formed_exports.includes=/packages/react-debug-tools -; well_formed_exports.includes=/packages/react-devtools -; well_formed_exports.includes=/packages/react-devtools-core -; well_formed_exports.includes=/packages/react-devtools-extensions -; well_formed_exports.includes=/packages/react-devtools-inline +well_formed_exports.includes=/packages/react-art +well_formed_exports.includes=/packages/react-cache +well_formed_exports.includes=/packages/react-client +well_formed_exports.includes=/packages/react-debug-tools +well_formed_exports.includes=/packages/react-devtools +well_formed_exports.includes=/packages/react-devtools-core +well_formed_exports.includes=/packages/react-devtools-extensions +well_formed_exports.includes=/packages/react-devtools-inline well_formed_exports.includes=/packages/react-devtools-shared well_formed_exports.includes=/packages/react-devtools-shell well_formed_exports.includes=/packages/react-devtools-timeline ; well_formed_exports.includes=/packages/react-dom ; well_formed_exports.includes=/packages/react-dom-bindings -; well_formed_exports.includes=/packages/react-fetch -; well_formed_exports.includes=/packages/react-fs -; well_formed_exports.includes=/packages/react-interactions -; well_formed_exports.includes=/packages/react-is +well_formed_exports.includes=/packages/react-fetch +well_formed_exports.includes=/packages/react-fs +well_formed_exports.includes=/packages/react-interactions +well_formed_exports.includes=/packages/react-is ; well_formed_exports.includes=/packages/react-native-renderer -; well_formed_exports.includes=/packages/react-noop-renderer -; well_formed_exports.includes=/packages/react-pg +well_formed_exports.includes=/packages/react-noop-renderer +well_formed_exports.includes=/packages/react-pg well_formed_exports.includes=/packages/react-reconciler -; well_formed_exports.includes=/packages/react-refresh -; well_formed_exports.includes=/packages/react-server -; well_formed_exports.includes=/packages/react-server-dom-relay -; well_formed_exports.includes=/packages/react-server-dom-webpack -; well_formed_exports.includes=/packages/react-server-native-relay -; well_formed_exports.includes=/packages/react-suspense-test-utils +well_formed_exports.includes=/packages/react-refresh +well_formed_exports.includes=/packages/react-server +well_formed_exports.includes=/packages/react-server-dom-relay +well_formed_exports.includes=/packages/react-server-dom-webpack +well_formed_exports.includes=/packages/react-server-native-relay +well_formed_exports.includes=/packages/react-suspense-test-utils ; well_formed_exports.includes=/packages/react-test-renderer well_formed_exports.includes=/packages/scheduler ; well_formed_exports.includes=/packages/shared -; well_formed_exports.includes=/packages/use-subscription -; well_formed_exports.includes=/packages/use-sync-external-store +well_formed_exports.includes=/packages/use-subscription +well_formed_exports.includes=/packages/use-sync-external-store # Substituted by createFlowConfig.js: %REACT_RENDERER_FLOW_OPTIONS%