mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Migrate to new variance syntax in libdef files (#57987)
Summary: Pull Request resolved: https://github.com/react/react-native/pull/57987 Changelog: [Internal] Reviewed By: huntie Differential Revision: D116336455 fbshipit-source-id: 91f8f8a337457045bd321ae638c0c8460d223471
This commit is contained in:
1 parent
42be7452d5
commit
4338af0514
4 files changed
+83
-83
No files matched your search
+14
-14
@@ -393,10 +393,10 @@ declare module '@babel/traverse' {
|
||||
constructor(path: NodePath<>): Scope;
|
||||
path: NodePath<>;
|
||||
block: BabelNode;
|
||||
+labels: Map<string, NodePath<>>;
|
||||
+parentBlock: BabelNode;
|
||||
+parent: Scope;
|
||||
+hub: HubInterface;
|
||||
readonly labels: Map<string, NodePath<>>;
|
||||
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<out TNode extends BabelNode = BabelNode> {
|
||||
parent: BabelNode;
|
||||
hub: HubInterface;
|
||||
contexts: Array<TraversalContext>;
|
||||
@@ -608,7 +608,7 @@ declare module '@babel/traverse' {
|
||||
shouldStop: boolean;
|
||||
removed: boolean;
|
||||
state: unknown;
|
||||
+opts: Readonly<TraverseOptions<unknown>> | null;
|
||||
readonly opts: Readonly<TraverseOptions<unknown>> | 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<CallExpression>` to a
|
||||
* `NodePath<Node> 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<in TNode extends BabelNode, TState> = (
|
||||
path: NodePath<TNode>,
|
||||
state: TState,
|
||||
) => void;
|
||||
|
||||
declare export type VisitNodeObject<
|
||||
-TNode extends BabelNode,
|
||||
in TNode extends BabelNode,
|
||||
TState,
|
||||
> = Partial<{
|
||||
enter(path: NodePath<TNode>, state: TState): void,
|
||||
exit(path: NodePath<TNode>, state: TState): void,
|
||||
}>;
|
||||
|
||||
declare export type VisitNode<-TNode extends BabelNode, TState> =
|
||||
declare export type VisitNode<in TNode extends BabelNode, TState> =
|
||||
VisitNodeFunction<TNode, TState> | VisitNodeObject<TNode, TState>;
|
||||
|
||||
declare export type Visitor<TState = void> = Readonly<{
|
||||
@@ -2202,10 +2202,10 @@ declare module '@babel/traverse' {
|
||||
parentPath?: ?NodePath<BabelNode>,
|
||||
): 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<TOptions>(
|
||||
node: BabelNode,
|
||||
|
||||
Vendored
+13
-13
@@ -454,13 +454,13 @@ declare module '@babel/core' {
|
||||
};
|
||||
|
||||
declare export class ConfigItem {
|
||||
+value: PluginObj<unknown> | (() => PluginObj<unknown>);
|
||||
+options: EntryOptions;
|
||||
+dirname: string;
|
||||
+name: string | void;
|
||||
+file: {
|
||||
+request: string,
|
||||
+resolved: string,
|
||||
readonly value: PluginObj<unknown> | (() => PluginObj<unknown>);
|
||||
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<ValidatedOptions>;
|
||||
+babelrc: string | void;
|
||||
+babelignore: string | void;
|
||||
+config: string | void;
|
||||
+files: ReadonlySet<string>;
|
||||
+fileHandling: 'ignored' | 'transpile' | 'unsupported';
|
||||
readonly options: Readonly<ValidatedOptions>;
|
||||
readonly babelrc: string | void;
|
||||
readonly babelignore: string | void;
|
||||
readonly config: string | void;
|
||||
readonly files: ReadonlySet<string>;
|
||||
readonly fileHandling: 'ignored' | 'transpile' | 'unsupported';
|
||||
|
||||
constructor(options: ValidatedOptions): PartialConfig;
|
||||
|
||||
|
||||
+14
-14
@@ -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<Array<number>>,
|
||||
readonly getEpilogues?: () => Array<Array<number>>,
|
||||
|
||||
/**
|
||||
* 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<unknown>,
|
||||
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?: <TArguments extends Array<unknown>>(
|
||||
readonly enqueueJob?: <TArguments extends Array<unknown>>(
|
||||
jobCallback: (...args: TArguments) => unknown,
|
||||
) => void,
|
||||
};
|
||||
Vendored
+42
-42
@@ -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<string>,
|
||||
readonly argv?: ReadonlyArray<string>,
|
||||
},
|
||||
|
||||
// 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,
|
||||
|
||||
Reference in new issue
Block a user