diff --git a/flow-typed/npm/babel-traverse_v7.x.x.js b/flow-typed/npm/babel-traverse_v7.x.x.js index 2defea348c07..e947d24a18a8 100644 --- a/flow-typed/npm/babel-traverse_v7.x.x.js +++ b/flow-typed/npm/babel-traverse_v7.x.x.js @@ -393,10 +393,10 @@ declare module '@babel/traverse' { constructor(path: NodePath<>): Scope; path: NodePath<>; block: BabelNode; - +labels: Map>; - +parentBlock: BabelNode; - +parent: Scope; - +hub: HubInterface; + readonly labels: Map>; + readonly parentBlock: BabelNode; + readonly parent: Scope; + readonly hub: HubInterface; bindings?: {[name: string]: Binding}; references?: {[name: string]: boolean}; globals?: {[name: string]: BabelNode}; @@ -599,7 +599,7 @@ declare module '@babel/traverse' { declare type Opts = {...}; - declare export class NodePath<+TNode extends BabelNode = BabelNode> { + declare export class NodePath { parent: BabelNode; hub: HubInterface; contexts: Array; @@ -608,7 +608,7 @@ declare module '@babel/traverse' { shouldStop: boolean; removed: boolean; state: unknown; - +opts: Readonly> | null; + readonly opts: Readonly> | null; skipKeys: null | {[key: string]: boolean}; parentPath: ?NodePath<>; context: TraversalContext; @@ -621,7 +621,7 @@ declare module '@babel/traverse' { * work with `NodePath`, e.g. that passing `NodePath` to a * `NodePath works. */ - +node: TNode; + readonly node: TNode; parentKey: string; scope: Scope; @@ -1731,20 +1731,20 @@ declare module '@babel/traverse' { // END GENERATED NODE PATH METHODS } - declare export type VisitNodeFunction<-TNode extends BabelNode, TState> = ( + declare export type VisitNodeFunction = ( path: NodePath, state: TState, ) => void; declare export type VisitNodeObject< - -TNode extends BabelNode, + in TNode extends BabelNode, TState, > = Partial<{ enter(path: NodePath, state: TState): void, exit(path: NodePath, state: TState): void, }>; - declare export type VisitNode<-TNode extends BabelNode, TState> = + declare export type VisitNode = VisitNodeFunction | VisitNodeObject; declare export type Visitor = Readonly<{ @@ -2202,10 +2202,10 @@ declare module '@babel/traverse' { parentPath?: ?NodePath, ): void, - +cache: Cache, - +visitors: Visitors, - +verify: Visitors['verify'], - +explode: Visitors['explode'], + readonly cache: Cache, + readonly visitors: Visitors, + readonly verify: Visitors['verify'], + readonly explode: Visitors['explode'], cheap( node: BabelNode, diff --git a/flow-typed/npm/babel_v7.x.x.js b/flow-typed/npm/babel_v7.x.x.js index 56531b19c56c..fa78c6124859 100644 --- a/flow-typed/npm/babel_v7.x.x.js +++ b/flow-typed/npm/babel_v7.x.x.js @@ -454,13 +454,13 @@ declare module '@babel/core' { }; declare export class ConfigItem { - +value: PluginObj | (() => PluginObj); - +options: EntryOptions; - +dirname: string; - +name: string | void; - +file: { - +request: string, - +resolved: string, + readonly value: PluginObj | (() => PluginObj); + readonly options: EntryOptions; + readonly dirname: string; + readonly name: string | void; + readonly file: { + readonly request: string, + readonly resolved: string, } | void; constructor(descriptor: UnloadedDescriptor): ConfigItem; @@ -1110,12 +1110,12 @@ declare module '@babel/core' { declare type ValidatedOptions = BabelCoreOptions; declare class PartialConfig { - +options: Readonly; - +babelrc: string | void; - +babelignore: string | void; - +config: string | void; - +files: ReadonlySet; - +fileHandling: 'ignored' | 'transpile' | 'unsupported'; + readonly options: Readonly; + readonly babelrc: string | void; + readonly babelignore: string | void; + readonly config: string | void; + readonly files: ReadonlySet; + readonly fileHandling: 'ignored' | 'transpile' | 'unsupported'; constructor(options: ValidatedOptions): PartialConfig; diff --git a/packages/react-native/flow/HermesInternalType.js b/packages/react-native/flow/HermesInternalType.js index eb017fc41d57..762b942bde38 100644 --- a/packages/react-native/flow/HermesInternalType.js +++ b/packages/react-native/flow/HermesInternalType.js @@ -26,11 +26,11 @@ declare type $HermesInternalType = { // All members are optional because they may not exist when OTA'd to older // VMs. - +getNumGCs?: () => number, - +getGCTime?: () => number, - +getNativeCallTime?: () => number, - +getNativeCallCount?: () => number, - +getGCCPUTime?: () => number, + readonly getNumGCs?: () => number, + readonly getGCTime?: () => number, + readonly getNativeCallTime?: () => number, + readonly getNativeCallCount?: () => number, + readonly getGCCPUTime?: () => number, /** * Hermes can embed an "epilogue" to the bytecode file with arbitrary bytes. @@ -39,7 +39,7 @@ declare type $HermesInternalType = { * Calling this function will return all such epilogues and convert the * bytes to numbers in the range of 0-255. */ - +getEpilogues?: () => Array>, + readonly getEpilogues?: () => Array>, /** * Query the VM for various statistics about performance. @@ -48,7 +48,7 @@ declare type $HermesInternalType = { * @return An object that maps strings to various types of performance * statistics. */ - +getInstrumentedStats?: () => {[string]: number | string, ...}, + readonly getInstrumentedStats?: () => {[string]: number | string, ...}, /** * Query the VM for any sort of runtime properties that it wants to report. @@ -56,7 +56,7 @@ declare type $HermesInternalType = { * printed for informational purposes. * @return An object that maps strings to various types of runtime properties. */ - +getRuntimeProperties?: () => { + readonly getRuntimeProperties?: () => { 'OSS Release Version': string, Build: string, [string]: unknown, @@ -69,7 +69,7 @@ declare type $HermesInternalType = { * This can be called several times but will have no effect after the first * call. */ - +ttiReached?: () => void, + readonly ttiReached?: () => void, /** * Tell Hermes that at this point the surface has transitioned from TTRC to @@ -78,12 +78,12 @@ declare type $HermesInternalType = { * This can be called several times but will have no effect after the first * call. */ - +ttrcReached?: () => void, + readonly ttrcReached?: () => void, /** * Query the VM to see whether or not it enabled Promise. */ - +hasPromise?: () => boolean, + readonly hasPromise?: () => boolean, /** * Enable promise rejection tracking with the given options. @@ -91,7 +91,7 @@ declare type $HermesInternalType = { * the `enable` function of module `promise/setimmediate/rejection-tracking` * declared in ./flow-typed/npm/promise_v8.x.x.js. */ - +enablePromiseRejectionTracker?: ( + readonly enablePromiseRejectionTracker?: ( options: ?{ whitelist?: ?Array, allRejections?: ?boolean, @@ -103,12 +103,12 @@ declare type $HermesInternalType = { /** * Query the VM to see whether or not it use the engine Job queue. */ - +useEngineQueue?: () => boolean, + readonly useEngineQueue?: () => boolean, /** * Enqueue a JavaScript callback function as a Job into the engine Job queue. */ - +enqueueJob?: >( + readonly enqueueJob?: >( jobCallback: (...args: TArguments) => unknown, ) => void, }; diff --git a/packages/react-native/flow/global.js b/packages/react-native/flow/global.js index 3082f3fc48c1..f7da9a277f85 100644 --- a/packages/react-native/flow/global.js +++ b/packages/react-native/flow/global.js @@ -18,70 +18,70 @@ // $FlowFixMe[libdef-override] declare var global: { // setUpGlobals - +window: typeof global, - +self: typeof global, - +process: { - +env: { - +NODE_ENV: 'development' | 'production', + readonly window: typeof global, + readonly self: typeof global, + readonly process: { + readonly env: { + readonly NODE_ENV: 'development' | 'production', }, - +argv?: ReadonlyArray, + readonly argv?: ReadonlyArray, }, // setUpPerformance - +performance: Performance, + readonly performance: Performance, // setUpXHR - +XMLHttpRequest: typeof XMLHttpRequest, - +FormData: typeof FormData, - +fetch: typeof fetch, - +Headers: typeof Headers, - +Request: typeof Request, - +Response: typeof Response, - +WebSocket: typeof WebSocket, - +Blob: typeof Blob, - +File: typeof File, - +FileReader: typeof FileReader, - +URL: typeof URL, - +URLSearchParams: typeof URLSearchParams, - +AbortController: typeof AbortController, - +AbortSignal: typeof AbortSignal, + readonly XMLHttpRequest: typeof XMLHttpRequest, + readonly FormData: typeof FormData, + readonly fetch: typeof fetch, + readonly Headers: typeof Headers, + readonly Request: typeof Request, + readonly Response: typeof Response, + readonly WebSocket: typeof WebSocket, + readonly Blob: typeof Blob, + readonly File: typeof File, + readonly FileReader: typeof FileReader, + readonly URL: typeof URL, + readonly URLSearchParams: typeof URLSearchParams, + readonly AbortController: typeof AbortController, + readonly AbortSignal: typeof AbortSignal, // setUpAlert - +alert: typeof alert, + readonly alert: typeof alert, // setUpNavigator - +navigator: { - +product: 'ReactNative', - +appName?: ?string, + readonly navigator: { + readonly product: 'ReactNative', + readonly appName?: ?string, ... }, // setUpTimers - +setInterval: typeof setInterval, - +clearInterval: typeof clearInterval, - +setTimeout: typeof setTimeout, - +clearTimeout: typeof clearTimeout, - +requestAnimationFrame: typeof requestAnimationFrame, - +cancelAnimationFrame: typeof cancelAnimationFrame, - +requestIdleCallback: typeof requestIdleCallback, - +cancelIdleCallback: typeof cancelIdleCallback, - +queueMicrotask: typeof queueMicrotask, - +setImmediate: typeof setImmediate, - +clearImmediate: typeof clearImmediate, + readonly setInterval: typeof setInterval, + readonly clearInterval: typeof clearInterval, + readonly setTimeout: typeof setTimeout, + readonly clearTimeout: typeof clearTimeout, + readonly requestAnimationFrame: typeof requestAnimationFrame, + readonly cancelAnimationFrame: typeof cancelAnimationFrame, + readonly requestIdleCallback: typeof requestIdleCallback, + readonly cancelIdleCallback: typeof cancelIdleCallback, + readonly queueMicrotask: typeof queueMicrotask, + readonly setImmediate: typeof setImmediate, + readonly clearImmediate: typeof clearImmediate, // Polyfills - +console: typeof console, + readonly console: typeof console, // JavaScript environments specific - +HermesInternal: ?$HermesInternalType, + readonly HermesInternal: ?$HermesInternalType, // Internal-specific - +__DEV__?: boolean, - +RN$Bridgeless?: boolean, + readonly __DEV__?: boolean, + readonly RN$Bridgeless?: boolean, // setupDOM - +DOMRect: typeof DOMRect, - +DOMRectReadOnly: typeof DOMRectReadOnly, + readonly DOMRect: typeof DOMRect, + readonly DOMRectReadOnly: typeof DOMRectReadOnly, // Undeclared properties are implicitly `any`. [string | symbol]: any,