diff --git a/packages/react-client/src/forks/ReactFlightClientConfig.custom.js b/packages/react-client/src/forks/ReactFlightClientConfig.custom.js index 45a47a8c1405f..3add5988aab8a 100644 --- a/packages/react-client/src/forks/ReactFlightClientConfig.custom.js +++ b/packages/react-client/src/forks/ReactFlightClientConfig.custom.js @@ -23,7 +23,7 @@ // So `$$$config` looks like a global variable, but it's // really an argument to a top-level wrapping function. -declare var $$$config: any; +declare const $$$config: any; export opaque type ModuleLoading = mixed; export opaque type SSRModuleMap = mixed; diff --git a/packages/react-devtools-extensions/flow-typed/jest.js b/packages/react-devtools-extensions/flow-typed/jest.js index 066655593abb3..cdbe32bee7ba6 100644 --- a/packages/react-devtools-extensions/flow-typed/jest.js +++ b/packages/react-devtools-extensions/flow-typed/jest.js @@ -960,7 +960,7 @@ declare function beforeAll( ): void; /** A context for grouping tests together */ -declare var describe: { +declare const describe: { /** * Creates a block that groups together several related tests in one "test suite" */ @@ -991,7 +991,7 @@ declare var describe: { }; /** An individual test unit */ -declare var it: { +declare const it: { /** * An individual test unit * @@ -1079,15 +1079,15 @@ declare function fit( timeout?: number ): void; /** An individual test unit */ -declare var test: typeof it; +declare const test: typeof it; /** A disabled group of tests */ -declare var xdescribe: typeof describe; +declare const xdescribe: typeof describe; /** A focused group of tests */ -declare var fdescribe: typeof describe; +declare const fdescribe: typeof describe; /** A disabled individual test */ -declare var xit: typeof it; +declare const xit: typeof it; /** A disabled individual test */ -declare var xtest: typeof it; +declare const xtest: typeof it; type JestPrettyFormatColors = { comment: {close: string, open: string}, @@ -1139,7 +1139,7 @@ type JestPrettyFormatPlugin = { type JestPrettyFormatPlugins = Array; /** The expect function is used every time you want to test a value */ -declare var expect: { +declare const expect: { /** The object that you want to make assertions against */ ( value: any @@ -1173,4 +1173,4 @@ declare var expect: { }; /** Holds all functions related to manipulating test runner */ -declare var jest: JestObjectType; +declare const jest: JestObjectType; diff --git a/packages/react-native-renderer/src/ReactNativeTypes.js b/packages/react-native-renderer/src/ReactNativeTypes.js index f02b921b6ce7a..0b44ef7f81e39 100644 --- a/packages/react-native-renderer/src/ReactNativeTypes.js +++ b/packages/react-native-renderer/src/ReactNativeTypes.js @@ -125,7 +125,7 @@ export type NativeMethods = $ReadOnly<{| |}>; // This validates that INativeMethods and NativeMethods stay in sync using Flow! -declare var ensureNativeMethodsAreSynced: NativeMethods; +declare const ensureNativeMethodsAreSynced: NativeMethods; (ensureNativeMethodsAreSynced: INativeMethods); export type HostComponent = AbstractComponent>; diff --git a/packages/react-reconciler/src/ReactFiberDevToolsHook.js b/packages/react-reconciler/src/ReactFiberDevToolsHook.js index abf56e90fabc2..dead0fda4691c 100644 --- a/packages/react-reconciler/src/ReactFiberDevToolsHook.js +++ b/packages/react-reconciler/src/ReactFiberDevToolsHook.js @@ -41,7 +41,7 @@ import { import {setSuppressWarning} from 'shared/consoleWithStackDev'; import {disableLogs, reenableLogs} from 'shared/ConsolePatchingDev'; -declare var __REACT_DEVTOOLS_GLOBAL_HOOK__: Object | void; +declare const __REACT_DEVTOOLS_GLOBAL_HOOK__: Object | void; let rendererID = null; let injectedHook = null; diff --git a/packages/react-reconciler/src/forks/ReactFiberConfig.custom.js b/packages/react-reconciler/src/forks/ReactFiberConfig.custom.js index c2c6fd21e5987..5bf200268ef85 100644 --- a/packages/react-reconciler/src/forks/ReactFiberConfig.custom.js +++ b/packages/react-reconciler/src/forks/ReactFiberConfig.custom.js @@ -23,7 +23,7 @@ // So `$$$config` looks like a global variable, but it's // really an argument to a top-level wrapping function. -declare var $$$config: any; +declare const $$$config: any; export opaque type Type = mixed; // eslint-disable-line no-undef export opaque type Props = mixed; // eslint-disable-line no-undef export opaque type Container = mixed; // eslint-disable-line no-undef diff --git a/packages/react-server/src/ReactFlightServerConfigBundlerCustom.js b/packages/react-server/src/ReactFlightServerConfigBundlerCustom.js index e11c154d05f32..00578a4da2459 100644 --- a/packages/react-server/src/ReactFlightServerConfigBundlerCustom.js +++ b/packages/react-server/src/ReactFlightServerConfigBundlerCustom.js @@ -7,7 +7,7 @@ * @flow */ -declare var $$$config: any; +declare const $$$config: any; export opaque type ClientManifest = mixed; export opaque type ClientReference = mixed; // eslint-disable-line no-unused-vars diff --git a/packages/react-server/src/forks/ReactFizzConfig.custom.js b/packages/react-server/src/forks/ReactFizzConfig.custom.js index cf1e05a54165d..495a74fb18656 100644 --- a/packages/react-server/src/forks/ReactFizzConfig.custom.js +++ b/packages/react-server/src/forks/ReactFizzConfig.custom.js @@ -26,7 +26,7 @@ import type {Request} from 'react-server/src/ReactFizzServer'; import type {TransitionStatus} from 'react-reconciler/src/ReactFiberConfig'; -declare var $$$config: any; +declare const $$$config: any; export opaque type Destination = mixed; // eslint-disable-line no-undef export opaque type RenderState = mixed; export opaque type HoistableState = mixed; diff --git a/packages/react-server/src/forks/ReactServerStreamConfig.custom.js b/packages/react-server/src/forks/ReactServerStreamConfig.custom.js index e372e8903f856..22cd6551c0b28 100644 --- a/packages/react-server/src/forks/ReactServerStreamConfig.custom.js +++ b/packages/react-server/src/forks/ReactServerStreamConfig.custom.js @@ -23,7 +23,7 @@ // So `$$$config` looks like a global variable, but it's // really an argument to a top-level wrapping function. -declare var $$$config: any; +declare const $$$config: any; export opaque type Destination = mixed; // eslint-disable-line no-undef export opaque type PrecomputedChunk = mixed; // eslint-disable-line no-undef diff --git a/packages/scheduler/src/forks/SchedulerNative.js b/packages/scheduler/src/forks/SchedulerNative.js index a7370d92a650b..3832cbc69753e 100644 --- a/packages/scheduler/src/forks/SchedulerNative.js +++ b/packages/scheduler/src/forks/SchedulerNative.js @@ -32,7 +32,7 @@ type NativeSchedulerType = { unstable_now: () => DOMHighResTimeStamp, }; -declare var nativeRuntimeScheduler: void | NativeSchedulerType; +declare const nativeRuntimeScheduler: void | NativeSchedulerType; export const unstable_UserBlockingPriority: PriorityLevel = typeof nativeRuntimeScheduler !== 'undefined' diff --git a/scripts/flow/environment.js b/scripts/flow/environment.js index 255ed4a2b99ba..cba4dd5e61566 100644 --- a/scripts/flow/environment.js +++ b/scripts/flow/environment.js @@ -9,25 +9,25 @@ /* eslint-disable */ -declare var __PROFILE__: boolean; -declare var __UMD__: boolean; -declare var __EXPERIMENTAL__: boolean; -declare var __VARIANT__: boolean; +declare const __PROFILE__: boolean; +declare const __UMD__: boolean; +declare const __EXPERIMENTAL__: boolean; +declare const __VARIANT__: boolean; -declare var __REACT_DEVTOOLS_GLOBAL_HOOK__: any; /*?{ +declare const __REACT_DEVTOOLS_GLOBAL_HOOK__: any; /*?{ inject: ?((stuff: Object) => void) };*/ -declare var globalThis: Object; +declare const globalThis: Object; -declare var queueMicrotask: (fn: Function) => void; -declare var reportError: (error: mixed) => void; -declare var AggregateError: Class; +declare const queueMicrotask: (fn: Function) => void; +declare const reportError: (error: mixed) => void; +declare const AggregateError: Class; -declare var FinalizationRegistry: any; +declare const FinalizationRegistry: any; declare module 'create-react-class' { - declare var exports: React$CreateClass; + declare const exports: React$CreateClass; } // Flow hides the props of React$Element, this overrides it to unhide @@ -43,7 +43,7 @@ declare opaque type React$Element< +ref: any, }; -declare var trustedTypes: { +declare const trustedTypes: { isHTML: (value: any) => boolean, isScript: (value: any) => boolean, isScriptURL: (value: any) => boolean, @@ -89,22 +89,22 @@ declare module 'EventListener' { } declare function __webpack_chunk_load__(id: string): Promise; -declare var __webpack_require__: ((id: string) => any) & { +declare const __webpack_require__: ((id: string) => any) & { u: string => string, }; declare function __turbopack_load__(id: string): Promise; -declare var __turbopack_require__: ((id: string) => any) & { +declare const __turbopack_require__: ((id: string) => any) & { u: string => string, }; declare module 'fs/promises' { - declare var access: (path: string, mode?: number) => Promise; - declare var lstat: ( + declare const access: (path: string, mode?: number) => Promise; + declare const lstat: ( path: string, options?: ?{bigint?: boolean}, ) => Promise; - declare var readdir: ( + declare const readdir: ( path: string, options?: | ?string @@ -113,7 +113,7 @@ declare module 'fs/promises' { withFileTypes?: ?boolean, }, ) => Promise; - declare var readFile: ( + declare const readFile: ( path: string, options?: | ?string @@ -121,7 +121,7 @@ declare module 'fs/promises' { encoding?: ?string, }, ) => Promise; - declare var readlink: ( + declare const readlink: ( path: string, options?: | ?string @@ -129,7 +129,7 @@ declare module 'fs/promises' { encoding?: ?string, }, ) => Promise; - declare var realpath: ( + declare const realpath: ( path: string, options?: | ?string @@ -137,13 +137,13 @@ declare module 'fs/promises' { encoding?: ?string, }, ) => Promise; - declare var stat: ( + declare const stat: ( path: string, options?: ?{bigint?: boolean}, ) => Promise; } declare module 'pg' { - declare var Pool: (options: mixed) => { + declare const Pool: (options: mixed) => { query: (query: string, values?: Array) => void, }; } @@ -320,7 +320,7 @@ declare class AsyncLocalStorage { enterWith(store: T): void; } -declare var async_hooks: { +declare const async_hooks: { createHook(callbacks: any): any, executionAsyncId(): number, }; @@ -332,7 +332,7 @@ declare module 'node:worker_threads' { } } -declare var Bun: { +declare const Bun: { hash( input: string | $TypedArray | DataView | ArrayBuffer | SharedArrayBuffer, ): number, diff --git a/scripts/flow/react-devtools.js b/scripts/flow/react-devtools.js index 86968330ec31f..361ca168190ef 100644 --- a/scripts/flow/react-devtools.js +++ b/scripts/flow/react-devtools.js @@ -9,12 +9,12 @@ /* eslint-disable no-unused-vars */ -declare var __EXTENSION__: boolean; -declare var __TEST__: boolean; +declare const __EXTENSION__: boolean; +declare const __TEST__: boolean; -declare var DARK_MODE_DIMMED_WARNING_COLOR: string; -declare var DARK_MODE_DIMMED_ERROR_COLOR: string; -declare var DARK_MODE_DIMMED_LOG_COLOR: string; -declare var LIGHT_MODE_DIMMED_WARNING_COLOR: string; -declare var LIGHT_MODE_DIMMED_ERROR_COLOR: string; -declare var LIGHT_MODE_DIMMED_LOG_COLOR: string; +declare const DARK_MODE_DIMMED_WARNING_COLOR: string; +declare const DARK_MODE_DIMMED_ERROR_COLOR: string; +declare const DARK_MODE_DIMMED_LOG_COLOR: string; +declare const LIGHT_MODE_DIMMED_WARNING_COLOR: string; +declare const LIGHT_MODE_DIMMED_ERROR_COLOR: string; +declare const LIGHT_MODE_DIMMED_LOG_COLOR: string; diff --git a/scripts/flow/react-native-host-hooks.js b/scripts/flow/react-native-host-hooks.js index e1b8b0ca72a17..9c86a8ffeb95c 100644 --- a/scripts/flow/react-native-host-hooks.js +++ b/scripts/flow/react-native-host-hooks.js @@ -49,21 +49,21 @@ declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface' ): boolean; declare export function deepFreezeAndThrowOnMutationInDev(obj: T): T; declare export function flattenStyle(style: any): any; - declare export var RCTEventEmitter: { + declare export const RCTEventEmitter: { register: (eventEmitter: mixed) => void, ... }; - declare export var TextInputState: { + declare export const TextInputState: { blurTextInput: (object: any) => void, focusTextInput: (object: any) => void, ... }; - declare export var ReactFiberErrorDialog: { + declare export const ReactFiberErrorDialog: { showErrorDialog: (error: __CapturedError) => boolean, ... }; - declare export var Platform: {OS: string, ...}; - declare export var UIManager: { + declare export const Platform: {OS: string, ...}; + declare export const UIManager: { customBubblingEventTypes: Object, customDirectEventTypes: Object, createView: ( @@ -123,15 +123,15 @@ declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface' ) => void, ... }; - declare export var legacySendAccessibilityEvent: ( + declare export const legacySendAccessibilityEvent: ( reactTag: number, eventTypeName: string, ) => void; - declare export var BatchedBridge: { + declare export const BatchedBridge: { registerCallableModule: (name: string, module: Object) => void, ... }; - declare export var ReactNativeViewConfigRegistry: { + declare export const ReactNativeViewConfigRegistry: { customBubblingEventTypes: Object, customDirectEventTypes: Object, @@ -139,7 +139,7 @@ declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface' get: (name: string) => __ReactNativeBaseComponentViewConfig, ... }; - declare export var RawEventEmitter: { + declare export const RawEventEmitter: { emit: (channel: string, event: RawEventEmitterEvent) => string, ... }; @@ -171,7 +171,7 @@ declare const RN$enableMicrotasksInReact: boolean; // This is needed for a short term solution. // See https://github.com/facebook/react/pull/15490 for more info -declare var nativeFabricUIManager: { +declare const nativeFabricUIManager: { createNode: ( reactTag: number, viewName: string, diff --git a/scripts/flow/xplat.js b/scripts/flow/xplat.js index 9c458c2c8ef8c..61e3a5692f2e5 100644 --- a/scripts/flow/xplat.js +++ b/scripts/flow/xplat.js @@ -8,16 +8,16 @@ */ declare module 'ReactNativeInternalFeatureFlags' { - declare export var alwaysThrottleDisappearingFallbacks: boolean; - declare export var alwaysThrottleRetries: boolean; - declare export var consoleManagedByDevToolsDuringStrictMode: boolean; - declare export var enableAsyncActions: boolean; - declare export var enableComponentStackLocations: boolean; - declare export var enableDeferRootSchedulingToMicrotask: boolean; - declare export var enableInfiniteRenderLoopDetection: boolean; - declare export var enableRenderableContext: boolean; - declare export var enableUnifiedSyncLane: boolean; - declare export var enableUseRefAccessWarning: boolean; - declare export var passChildrenWhenCloningPersistedNodes: boolean; - declare export var useModernStrictMode: boolean; + declare export const alwaysThrottleDisappearingFallbacks: boolean; + declare export const alwaysThrottleRetries: boolean; + declare export const consoleManagedByDevToolsDuringStrictMode: boolean; + declare export const enableAsyncActions: boolean; + declare export const enableComponentStackLocations: boolean; + declare export const enableDeferRootSchedulingToMicrotask: boolean; + declare export const enableInfiniteRenderLoopDetection: boolean; + declare export const enableRenderableContext: boolean; + declare export const enableUnifiedSyncLane: boolean; + declare export const enableUseRefAccessWarning: boolean; + declare export const passChildrenWhenCloningPersistedNodes: boolean; + declare export const useModernStrictMode: boolean; } diff --git a/scripts/jest/typescript/jest.d.ts b/scripts/jest/typescript/jest.d.ts index 43aa392287e7c..57e93783665a7 100644 --- a/scripts/jest/typescript/jest.d.ts +++ b/scripts/jest/typescript/jest.d.ts @@ -1,16 +1,16 @@ -declare var __DEV__: boolean; -declare var __TEST__: boolean; -declare var __EXTENSION__: boolean; +declare const __DEV__: boolean; +declare const __TEST__: boolean; +declare const __EXTENSION__: boolean; declare function afterEach(fn: any): any; declare function beforeEach(fn: any): any; declare function describe(name: string, fn: any): void; -declare var it: { +declare const it: { (name: string, fn: any): void; only: (name: string, fn: any) => void; } declare function expect(val: any): Expect; -declare var jest: Jest; +declare const jest: Jest; declare function pit(name: string, fn: any): void; declare function spyOnDev(obj: any, key: string): any; declare function spyOnDevAndProd(obj: any, key: string): any; @@ -70,5 +70,5 @@ interface MockFunction { mockReturnValueOnce(value: any): MockFunction } -declare var check: any; -declare var gen: any; +declare const check: any; +declare const gen: any;