Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions flow-typed/npm/babel-traverse_v7.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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>;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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<{
Expand Down Expand Up @@ -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,
Expand Down
26 changes: 13 additions & 13 deletions flow-typed/npm/babel_v7.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
28 changes: 14 additions & 14 deletions packages/react-native/flow/HermesInternalType.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -48,15 +48,15 @@ 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.
* There are no guarantees about what keys exist in it, but they can be
* 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,
Expand All @@ -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
Expand All @@ -78,20 +78,20 @@ 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.
* The API mirrored the `promise` npm package, therefore it's typed same as
* 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,
Expand All @@ -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,
};
84 changes: 42 additions & 42 deletions packages/react-native/flow/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading