mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
transformTypeParamBound codemod 9/9 (#55948)
Summary: X-link: https://github.com/facebook/metro/pull/1665 Pull Request resolved: https://github.com/facebook/react-native/pull/55948 js1 flow-runner codemod flow/transformTypeParamBound --format-files=false xplat/js Changelog: [Internal] Reviewed By: SamChou19815 Differential Revision: D95429551 fbshipit-source-id: 6f5694fed74364c6f1c58e28376c86eae6201366
This commit is contained in:
1 parent
48b6f2dcc9
commit
53cd9cec15
17 files changed
+92
-82
No files matched your search
Vendored
+49
-45
@@ -21,7 +21,7 @@ interface ErrnoError extends Error {
|
||||
syscall?: string;
|
||||
}
|
||||
|
||||
type Node$Conditional<T: boolean, IfTrue, IfFalse> = T extends true
|
||||
type Node$Conditional<T extends boolean, IfTrue, IfFalse> = T extends true
|
||||
? IfTrue
|
||||
: T extends false
|
||||
? IfFalse
|
||||
@@ -282,7 +282,7 @@ type child_process$execFileOpts = Readonly<{
|
||||
signal?: AbortSignal,
|
||||
}>;
|
||||
|
||||
type child_process$execFileCallback<T: string | Buffer> =
|
||||
type child_process$execFileCallback<T extends string | Buffer> =
|
||||
child_process$execCallback<T>;
|
||||
|
||||
type child_process$execFileSyncOpts = Readonly<{
|
||||
@@ -414,7 +414,7 @@ type child_process$spawnOpts = Readonly<{
|
||||
serialization?: 'json' | 'advanced',
|
||||
}>;
|
||||
|
||||
type child_process$spawnSyncRet<T: string | Buffer> = Readonly<{
|
||||
type child_process$spawnSyncRet<T extends string | Buffer> = Readonly<{
|
||||
pid: number,
|
||||
output: Array<any>,
|
||||
// TODO: subprocess.stdout may be null in case of error
|
||||
@@ -454,9 +454,9 @@ type child_process$Serializable =
|
||||
type child_process$SendHandle = net$Server | net$Socket;
|
||||
|
||||
declare class child_process$ChildProcessTyped<
|
||||
TStdin: stream$Writable | null,
|
||||
TStdout: stream$Readable | null,
|
||||
TStderr: stream$Readable | null,
|
||||
TStdin extends stream$Writable | null,
|
||||
TStdout extends stream$Readable | null,
|
||||
TStderr extends stream$Readable | null,
|
||||
> extends events$EventEmitter
|
||||
{
|
||||
+stdin: TStdin;
|
||||
@@ -515,7 +515,7 @@ declare module 'child_process' {
|
||||
stream$Readable,
|
||||
>;
|
||||
|
||||
type StringOrBuffer<Opts, Default: string | Buffer> =
|
||||
type StringOrBuffer<Opts, Default extends string | Buffer> =
|
||||
Opts extends Readonly<{encoding: infer E, ...}>
|
||||
? E extends buffer$NonBufferEncoding
|
||||
? string
|
||||
@@ -524,11 +524,15 @@ declare module 'child_process' {
|
||||
: string | Buffer
|
||||
: Default;
|
||||
|
||||
type StreamForChannel<Channel: 0 | 1 | 2> = Channel extends 0
|
||||
type StreamForChannel<Channel extends 0 | 1 | 2> = Channel extends 0
|
||||
? stream$Writable
|
||||
: stream$Readable;
|
||||
|
||||
type MaybeStream<Opts, FD: 0 | 1 | 2, PipeByDefault: true | false = true> =
|
||||
type MaybeStream<
|
||||
Opts,
|
||||
FD extends 0 | 1 | 2,
|
||||
PipeByDefault extends true | false = true,
|
||||
> =
|
||||
Opts extends Readonly<{stdio: infer E, ...}>
|
||||
? E extends child_process$StdioPipe
|
||||
? StreamForChannel<FD>
|
||||
@@ -552,7 +556,7 @@ declare module 'child_process' {
|
||||
stream$Readable,
|
||||
>;
|
||||
|
||||
declare function exec<Opts: child_process$execOpts>(
|
||||
declare function exec<Opts extends child_process$execOpts>(
|
||||
command: string,
|
||||
options: Opts,
|
||||
callback?: child_process$execCallback<StringOrBuffer<Opts, string>>,
|
||||
@@ -562,11 +566,11 @@ declare module 'child_process' {
|
||||
stream$Readable,
|
||||
>;
|
||||
|
||||
declare function execSync<Opts: child_process$execSyncOpts>(
|
||||
declare function execSync<Opts extends child_process$execSyncOpts>(
|
||||
command: string,
|
||||
): Buffer;
|
||||
|
||||
declare function execSync<Opts: child_process$execSyncOpts>(
|
||||
declare function execSync<Opts extends child_process$execSyncOpts>(
|
||||
command: string,
|
||||
options: Opts,
|
||||
): StringOrBuffer<Opts, Buffer>;
|
||||
@@ -583,7 +587,7 @@ declare module 'child_process' {
|
||||
stream$Readable,
|
||||
>;
|
||||
|
||||
declare function execFile<Opts: child_process$execFileOpts>(
|
||||
declare function execFile<Opts extends child_process$execFileOpts>(
|
||||
file: string,
|
||||
args: ReadonlyArray<string>,
|
||||
options: Opts,
|
||||
@@ -594,7 +598,7 @@ declare module 'child_process' {
|
||||
stream$Readable,
|
||||
>;
|
||||
|
||||
declare function execFile<Opts: child_process$execFileOpts>(
|
||||
declare function execFile<Opts extends child_process$execFileOpts>(
|
||||
file: string,
|
||||
options: Opts,
|
||||
callback?: child_process$execFileCallback<StringOrBuffer<Opts, string>>,
|
||||
@@ -609,13 +613,13 @@ declare module 'child_process' {
|
||||
args?: ReadonlyArray<string>,
|
||||
): Buffer;
|
||||
|
||||
declare function execFileSync<Opts: child_process$execFileSyncOpts>(
|
||||
declare function execFileSync<Opts extends child_process$execFileSyncOpts>(
|
||||
command: string,
|
||||
args: ReadonlyArray<string>,
|
||||
options: Opts,
|
||||
): StringOrBuffer<Opts, Buffer>;
|
||||
|
||||
declare function execFileSync<Opts: child_process$execFileSyncOpts>(
|
||||
declare function execFileSync<Opts extends child_process$execFileSyncOpts>(
|
||||
command: string,
|
||||
options: Opts,
|
||||
): StringOrBuffer<Opts, Buffer>;
|
||||
@@ -625,7 +629,7 @@ declare module 'child_process' {
|
||||
args?: ReadonlyArray<string>,
|
||||
): child_process$ChildProcessTyped<null, null, null>;
|
||||
|
||||
declare function fork<Opts: child_process$forkOpts>(
|
||||
declare function fork<Opts extends child_process$forkOpts>(
|
||||
modulePath: string,
|
||||
args: ReadonlyArray<string>,
|
||||
options: Opts,
|
||||
@@ -635,7 +639,7 @@ declare module 'child_process' {
|
||||
MaybeStream<Opts, 2, false>,
|
||||
>;
|
||||
|
||||
declare function fork<Opts: child_process$forkOpts>(
|
||||
declare function fork<Opts extends child_process$forkOpts>(
|
||||
modulePath: string,
|
||||
options: Opts,
|
||||
): child_process$ChildProcessTyped<
|
||||
@@ -653,7 +657,7 @@ declare module 'child_process' {
|
||||
stream$Readable,
|
||||
>;
|
||||
|
||||
declare function spawn<Opts: child_process$spawnOpts>(
|
||||
declare function spawn<Opts extends child_process$spawnOpts>(
|
||||
command: string,
|
||||
args: ReadonlyArray<string>,
|
||||
options: Opts,
|
||||
@@ -663,7 +667,7 @@ declare module 'child_process' {
|
||||
MaybeStream<Opts, 2>,
|
||||
>;
|
||||
|
||||
declare function spawn<Opts: child_process$spawnOpts>(
|
||||
declare function spawn<Opts extends child_process$spawnOpts>(
|
||||
command: string,
|
||||
options: Opts,
|
||||
): child_process$ChildProcessTyped<
|
||||
@@ -677,13 +681,13 @@ declare module 'child_process' {
|
||||
args?: ReadonlyArray<string>,
|
||||
): child_process$spawnSyncRet<Buffer>;
|
||||
|
||||
declare function spawnSync<Opts: child_process$spawnSyncOpts>(
|
||||
declare function spawnSync<Opts extends child_process$spawnSyncOpts>(
|
||||
command: string,
|
||||
args: ReadonlyArray<string>,
|
||||
options: Opts,
|
||||
): child_process$spawnSyncRet<StringOrBuffer<Opts, Buffer>>;
|
||||
|
||||
declare function spawnSync<Opts: child_process$spawnSyncOpts>(
|
||||
declare function spawnSync<Opts extends child_process$spawnSyncOpts>(
|
||||
command: string,
|
||||
options: Opts,
|
||||
): child_process$spawnSyncRet<StringOrBuffer<Opts, Buffer>>;
|
||||
@@ -2112,7 +2116,7 @@ declare module 'fs' {
|
||||
}>,
|
||||
): void;
|
||||
|
||||
declare type GlobOptions<WithFileTypes: boolean> = Readonly<{
|
||||
declare type GlobOptions<WithFileTypes extends boolean> = Readonly<{
|
||||
/**
|
||||
* Current working directory.
|
||||
* @default process.cwd()
|
||||
@@ -2154,7 +2158,7 @@ declare module 'fs' {
|
||||
callback: (err: ?ErrnoError, matches: Array<string>) => void,
|
||||
): void;
|
||||
|
||||
declare function glob<WithFileTypes: boolean = false>(
|
||||
declare function glob<WithFileTypes extends boolean = false>(
|
||||
pattern: string | ReadonlyArray<string>,
|
||||
options: GlobOptions<WithFileTypes>,
|
||||
callback: (
|
||||
@@ -2172,7 +2176,7 @@ declare module 'fs' {
|
||||
* @since v22.0.0
|
||||
* @returns paths of files that match the pattern.
|
||||
*/
|
||||
declare function globSync<WithFileTypes: boolean = false>(
|
||||
declare function globSync<WithFileTypes extends boolean = false>(
|
||||
pattern: string | ReadonlyArray<string>,
|
||||
options?: GlobOptions<WithFileTypes>,
|
||||
): Node$Conditional<WithFileTypes, Array<Dirent>, Array<string>>;
|
||||
@@ -2289,7 +2293,7 @@ declare module 'fs' {
|
||||
): WriteStream;
|
||||
datasync(): Promise<void>;
|
||||
fd: number;
|
||||
read<T: Buffer | Uint8Array>(
|
||||
read<T extends Buffer | Uint8Array>(
|
||||
buffer: T,
|
||||
offset: number,
|
||||
length: number,
|
||||
@@ -2314,7 +2318,7 @@ declare module 'fs' {
|
||||
highWaterMark?: number,
|
||||
}>,
|
||||
): readline$Interface;
|
||||
readv<T: Array<Buffer> | Array<Uint8Array> | Array<DataView>>(
|
||||
readv<T extends Array<Buffer> | Array<Uint8Array> | Array<DataView>>(
|
||||
buffers: T,
|
||||
position?: number | null,
|
||||
): Promise<{buffers: T, bytesRead: number}>;
|
||||
@@ -2340,7 +2344,7 @@ declare module 'fs' {
|
||||
}>,
|
||||
): Promise<void>;
|
||||
writeFile: AppendOrWriteToFileHandle;
|
||||
writev<T: Array<Buffer> | Array<Uint8Array> | Array<DataView>>(
|
||||
writev<T extends Array<Buffer> | Array<Uint8Array> | Array<DataView>>(
|
||||
buffers: T,
|
||||
position?: number | null,
|
||||
): Promise<{buffers: T, bytesWritten: number}>;
|
||||
@@ -2386,7 +2390,7 @@ declare module 'fs' {
|
||||
atime: number | string | Date,
|
||||
mtime: number | string | Date,
|
||||
): Promise<void>,
|
||||
glob<WithFileTypes: boolean = false>(
|
||||
glob<WithFileTypes extends boolean = false>(
|
||||
pattern: string | ReadonlyArray<string>,
|
||||
options?: GlobOptions<WithFileTypes>,
|
||||
): Node$Conditional<
|
||||
@@ -2422,7 +2426,7 @@ declare module 'fs' {
|
||||
recursive?: boolean,
|
||||
}>,
|
||||
): Promise<Dir>,
|
||||
read<T: Buffer | Uint8Array>(
|
||||
read<T extends Buffer | Uint8Array>(
|
||||
filehandle: FileHandle,
|
||||
buffer: T,
|
||||
offset: number,
|
||||
@@ -2503,7 +2507,7 @@ declare module 'fs' {
|
||||
overflow?: 'ignore' | 'throw',
|
||||
}>,
|
||||
): AsyncIterator<{eventType: string, filename: ?string}>,
|
||||
write<T: Buffer | Uint8Array>(
|
||||
write<T extends Buffer | Uint8Array>(
|
||||
filehandle: FileHandle,
|
||||
buffer: T,
|
||||
offset: number,
|
||||
@@ -3314,7 +3318,7 @@ declare module 'perf_hooks' {
|
||||
now(): number;
|
||||
setResourceTimingBufferSize(maxSize: number): void;
|
||||
+timeOrigin: number;
|
||||
timerify<TArgs: Iterable<unknown>, TReturn>(
|
||||
timerify<TArgs extends Iterable<unknown>, TReturn>(
|
||||
fn: (...TArgs) => TReturn,
|
||||
options?: Readonly<{histogram?: RecordableHistogram}>,
|
||||
): (...TArgs) => TReturn;
|
||||
@@ -3609,7 +3613,7 @@ declare class stream$Readable extends stream$Stream {
|
||||
destroy(error?: Error): this;
|
||||
isPaused(): boolean;
|
||||
pause(): this;
|
||||
pipe<T: stream$Writable>(dest: T, options?: {end?: boolean, ...}): T;
|
||||
pipe<T extends stream$Writable>(dest: T, options?: {end?: boolean, ...}): T;
|
||||
read(size?: number): ?(string | Buffer);
|
||||
readable: boolean;
|
||||
readableHighWaterMark: number;
|
||||
@@ -3773,25 +3777,25 @@ declare module 'stream' {
|
||||
},
|
||||
callback: (error?: Error) => void,
|
||||
): () => void;
|
||||
declare function pipeline<T: stream$Writable>(
|
||||
declare function pipeline<T extends stream$Writable>(
|
||||
s1: stream$Readable,
|
||||
last: T,
|
||||
cb: (error?: Error) => void,
|
||||
): T;
|
||||
declare function pipeline<T: stream$Writable>(
|
||||
declare function pipeline<T extends stream$Writable>(
|
||||
s1: stream$Readable,
|
||||
s2: stream$Duplex,
|
||||
last: T,
|
||||
cb: (error?: Error) => void,
|
||||
): T;
|
||||
declare function pipeline<T: stream$Writable>(
|
||||
declare function pipeline<T extends stream$Writable>(
|
||||
s1: stream$Readable,
|
||||
s2: stream$Duplex,
|
||||
s3: stream$Duplex,
|
||||
last: T,
|
||||
cb: (error?: Error) => void,
|
||||
): T;
|
||||
declare function pipeline<T: stream$Writable>(
|
||||
declare function pipeline<T extends stream$Writable>(
|
||||
s1: stream$Readable,
|
||||
s2: stream$Duplex,
|
||||
s3: stream$Duplex,
|
||||
@@ -3799,7 +3803,7 @@ declare module 'stream' {
|
||||
last: T,
|
||||
cb: (error?: Error) => void,
|
||||
): T;
|
||||
declare function pipeline<T: stream$Writable>(
|
||||
declare function pipeline<T extends stream$Writable>(
|
||||
s1: stream$Readable,
|
||||
s2: stream$Duplex,
|
||||
s3: stream$Duplex,
|
||||
@@ -3808,7 +3812,7 @@ declare module 'stream' {
|
||||
last: T,
|
||||
cb: (error?: Error) => void,
|
||||
): T;
|
||||
declare function pipeline<T: stream$Writable>(
|
||||
declare function pipeline<T extends stream$Writable>(
|
||||
s1: stream$Readable,
|
||||
s2: stream$Duplex,
|
||||
s3: stream$Duplex,
|
||||
@@ -4191,19 +4195,19 @@ declare module 'timers' {
|
||||
// [key: $SymbolDispose]: () => void;
|
||||
}
|
||||
|
||||
declare export function setTimeout<TArgs: Iterable<unknown>>(
|
||||
declare export function setTimeout<TArgs extends Iterable<unknown>>(
|
||||
callback: (...args: TArgs) => unknown,
|
||||
delay?: number,
|
||||
...args: TArgs
|
||||
): Timeout;
|
||||
|
||||
declare export function setInterval<TArgs: Iterable<unknown>>(
|
||||
declare export function setInterval<TArgs extends Iterable<unknown>>(
|
||||
callback: (...args: TArgs) => unknown,
|
||||
delay?: number,
|
||||
...args: TArgs
|
||||
): Timeout;
|
||||
|
||||
declare export function setImmediate<TArgs: Iterable<unknown>>(
|
||||
declare export function setImmediate<TArgs extends Iterable<unknown>>(
|
||||
callback: (...args: TArgs) => unknown,
|
||||
...args: TArgs
|
||||
): Immediate;
|
||||
@@ -4500,7 +4504,7 @@ declare module 'util' {
|
||||
declare function stripVTControlCharacters(str: string): string;
|
||||
|
||||
declare function parseArgs<
|
||||
TOptions: {+[string]: util$ParseArgsOption} = {},
|
||||
TOptions extends {+[string]: util$ParseArgsOption} = {},
|
||||
>(config: {
|
||||
args?: Array<string>,
|
||||
options?: TOptions,
|
||||
@@ -4514,7 +4518,7 @@ declare module 'util' {
|
||||
};
|
||||
|
||||
declare function parseArgs<
|
||||
TOptions: {[string]: util$ParseArgsOption} = {},
|
||||
TOptions extends {[string]: util$ParseArgsOption} = {},
|
||||
>(config: {
|
||||
args?: Array<string>,
|
||||
options?: TOptions,
|
||||
@@ -5658,7 +5662,7 @@ declare class Process extends events$EventEmitter {
|
||||
setegid?: (id: number | string) => void;
|
||||
seteuid?: (id: number | string) => void;
|
||||
setgid?: (id: number | string) => void;
|
||||
setgroups?: <Group: string | number>(groups: Array<Group>) => void;
|
||||
setgroups?: <Group extends string | number>(groups: Array<Group>) => void;
|
||||
setuid?: (id: number | string) => void;
|
||||
stderr: stream$Writable | tty$WriteStream;
|
||||
stdin: stream$Readable | tty$ReadStream;
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ declare module '@isaacs/ttlcache' {
|
||||
* as in `cache.set(key, undefined)`. Use `cache.has()` to determine
|
||||
* whether a key is present in the cache at all.
|
||||
*/
|
||||
get<T: V = V>(key: K, options?: TTLCache$GetOptions): T | void;
|
||||
get<T extends V = V>(key: K, options?: TTLCache$GetOptions): T | void;
|
||||
|
||||
/**
|
||||
* Check if a key is in the cache.
|
||||
|
||||
+11
-8
@@ -25,7 +25,7 @@ declare module '@babel/traverse' {
|
||||
getCode(): ?string;
|
||||
getScope(): ?Scope;
|
||||
addHelper(name: string): {};
|
||||
buildError<TError: Error>(
|
||||
buildError<TError extends Error>(
|
||||
node: BabelNode,
|
||||
msg: string,
|
||||
Error: Class<TError>,
|
||||
@@ -37,7 +37,7 @@ declare module '@babel/traverse' {
|
||||
getCode(): ?string;
|
||||
getScope(): ?Scope;
|
||||
addHelper(name: string): {};
|
||||
buildError<TError: Error>(
|
||||
buildError<TError extends Error>(
|
||||
node: BabelNode,
|
||||
msg: string,
|
||||
Error: Class<TError>,
|
||||
@@ -294,7 +294,7 @@ declare module '@babel/traverse' {
|
||||
|
||||
declare type Opts = {...};
|
||||
|
||||
declare export class NodePath<+TNode: BabelNode = BabelNode> {
|
||||
declare export class NodePath<+TNode extends BabelNode = BabelNode> {
|
||||
parent: BabelNode;
|
||||
hub: HubInterface;
|
||||
contexts: Array<TraversalContext>;
|
||||
@@ -340,7 +340,7 @@ declare module '@babel/traverse' {
|
||||
setData<TVal>(key: string, val: TVal): TVal;
|
||||
getData<TVal = unknown>(key: string, def?: TVal): TVal;
|
||||
|
||||
buildCodeFrameError<TError: Error>(
|
||||
buildCodeFrameError<TError extends Error>(
|
||||
msg: string,
|
||||
Error?: Class<TError>,
|
||||
): TError;
|
||||
@@ -724,7 +724,7 @@ declare module '@babel/traverse' {
|
||||
|
||||
getAllPrevSiblings(): Array<NodePath<>>;
|
||||
|
||||
get<TKey: keyof TNode>(
|
||||
get<TKey extends keyof TNode>(
|
||||
key: TKey,
|
||||
context?: boolean | TraversalContext,
|
||||
): TNode[TKey] extends BabelNode ? NodePath<> : Array<NodePath<>>;
|
||||
@@ -1432,17 +1432,20 @@ declare module '@babel/traverse' {
|
||||
// END GENERATED NODE PATH METHODS
|
||||
}
|
||||
|
||||
declare export type VisitNodeFunction<-TNode: BabelNode, TState> = (
|
||||
declare export type VisitNodeFunction<-TNode extends BabelNode, TState> = (
|
||||
path: NodePath<TNode>,
|
||||
state: TState,
|
||||
) => void;
|
||||
|
||||
declare export type VisitNodeObject<-TNode: BabelNode, TState> = Partial<{
|
||||
declare export type VisitNodeObject<
|
||||
-TNode extends BabelNode,
|
||||
TState,
|
||||
> = Partial<{
|
||||
enter(path: NodePath<TNode>, state: TState): void,
|
||||
exit(path: NodePath<TNode>, state: TState): void,
|
||||
}>;
|
||||
|
||||
declare export type VisitNode<-TNode: BabelNode, TState> =
|
||||
declare export type VisitNode<-TNode extends BabelNode, TState> =
|
||||
| VisitNodeFunction<TNode, TState>
|
||||
| VisitNodeObject<TNode, TState>;
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -353,7 +353,7 @@ declare module '@babel/core' {
|
||||
raw: BabelNodeArrayExpression,
|
||||
): BabelNodeIdentifier;
|
||||
|
||||
buildCodeFrameError<TError: Error>(
|
||||
buildCodeFrameError<TError extends Error>(
|
||||
node: BabelNode,
|
||||
msg: string,
|
||||
Class<TError>,
|
||||
|
||||
Vendored
+5
-2
@@ -13,7 +13,7 @@
|
||||
|
||||
// MODIFIED: Added ESLint suppression comment - no-unused-vars doesn't understand declaration files
|
||||
|
||||
type JestMockFn<TArguments: ReadonlyArray<unknown>, TReturn> = {
|
||||
type JestMockFn<TArguments extends ReadonlyArray<unknown>, TReturn> = {
|
||||
(...args: TArguments): TReturn,
|
||||
/**
|
||||
* An object for introspecting mock calls
|
||||
@@ -881,7 +881,10 @@ type JestObjectType = {
|
||||
* implementation.
|
||||
*/
|
||||
// MODIFIED: Added defaults to type arguments.
|
||||
fn<TArguments: ReadonlyArray<unknown> = ReadonlyArray<any>, TReturn = any>(
|
||||
fn<
|
||||
TArguments extends ReadonlyArray<unknown> = ReadonlyArray<any>,
|
||||
TReturn = any,
|
||||
>(
|
||||
implementation?: (...args: TArguments) => TReturn,
|
||||
): JestMockFn<TArguments, TReturn>,
|
||||
/**
|
||||
|
||||
Vendored
+4
-4
@@ -2196,7 +2196,7 @@ declare module 'rxjs/operators' {
|
||||
key: keyof T,
|
||||
): rxjs$MonoTypeOperatorFunction<T>;
|
||||
|
||||
declare export function distinctUntilKeyChanged<T, K: keyof T>(
|
||||
declare export function distinctUntilKeyChanged<T, K extends keyof T>(
|
||||
key: K,
|
||||
compare: (x: unknown, y: unknown) => boolean,
|
||||
): rxjs$MonoTypeOperatorFunction<T>;
|
||||
@@ -2291,7 +2291,7 @@ declare module 'rxjs/operators' {
|
||||
scheduler?: rxjs$SchedulerLike,
|
||||
): rxjs$MonoTypeOperatorFunction<T>;
|
||||
|
||||
declare export function filter<T, S: T>(
|
||||
declare export function filter<T, S extends T>(
|
||||
predicate: (value: T, index: number) => boolean,
|
||||
thisArg?: any,
|
||||
): rxjs$OperatorFunction<T, S>;
|
||||
@@ -2305,7 +2305,7 @@ declare module 'rxjs/operators' {
|
||||
callback: () => void,
|
||||
): rxjs$MonoTypeOperatorFunction<T>;
|
||||
|
||||
declare export function find<T, S: T>(
|
||||
declare export function find<T, S extends T>(
|
||||
predicate: (value: T, index: number, source: rxjs$Observable<T>) => boolean,
|
||||
thisArg?: any,
|
||||
): rxjs$OperatorFunction<T, T | S | void>;
|
||||
@@ -2938,7 +2938,7 @@ declare module 'rxjs/operators' {
|
||||
notifier: rxjs$Observable<any>,
|
||||
): rxjs$MonoTypeOperatorFunction<T>;
|
||||
|
||||
declare export function takeWhile<T, S: T>(
|
||||
declare export function takeWhile<T, S extends T>(
|
||||
predicate: (value: T, index: number) => S,
|
||||
inclusive?: boolean,
|
||||
): rxjs$OperatorFunction<T, S>;
|
||||
|
||||
Vendored
+3
-3
@@ -27,14 +27,14 @@ declare interface $npm$shelljs$Env {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
declare type $npm$shelljs$OptionsPoly<Flags: string> = {
|
||||
declare type $npm$shelljs$OptionsPoly<Flags extends string> = {
|
||||
[keys: Flags]: boolean,
|
||||
...
|
||||
};
|
||||
declare interface $npm$shelljs$ExecThen {
|
||||
(code: number, stdout: string, stderr: string): void;
|
||||
}
|
||||
declare type $npm$shelljs$ExecOptionsPoly<T: Object> = {
|
||||
declare type $npm$shelljs$ExecOptionsPoly<T extends Object> = {
|
||||
...T,
|
||||
async?: boolean,
|
||||
silent?: boolean,
|
||||
@@ -140,7 +140,7 @@ declare interface $npm$shelljs$Result {
|
||||
declare module 'shelljs' {
|
||||
declare export type ShellArray<T> = $npm$shelljs$Array<T>;
|
||||
declare export type ShellAsync = $npm$shelljs$Async;
|
||||
declare export type ShellOptionsPoly<Flags: string> =
|
||||
declare export type ShellOptionsPoly<Flags extends string> =
|
||||
$npm$shelljs$OptionsPoly<Flags>;
|
||||
declare export type ShellConfig = $npm$shelljs$Config;
|
||||
declare export type ShellEnv = $npm$shelljs$Env;
|
||||
|
||||
+3
-3
@@ -30,7 +30,7 @@ export type OverridesFor<T> = Partial<{
|
||||
[key in keyof T]: Getter<?ReturnType<T[key]>>,
|
||||
}>;
|
||||
|
||||
function createGetter<T: boolean | number | string>(
|
||||
function createGetter<T extends boolean | number | string>(
|
||||
configName: string,
|
||||
customValueGetter: Getter<?T>,
|
||||
defaultValue: T,
|
||||
@@ -52,7 +52,7 @@ function createGetter<T: boolean | number | string>(
|
||||
}
|
||||
|
||||
export function createJavaScriptFlagGetter<
|
||||
K: keyof ReactNativeFeatureFlagsJsOnly,
|
||||
K extends keyof ReactNativeFeatureFlagsJsOnly,
|
||||
>(
|
||||
configName: K,
|
||||
defaultValue: ReturnType<ReactNativeFeatureFlagsJsOnly[K]>,
|
||||
@@ -69,7 +69,7 @@ export function createJavaScriptFlagGetter<
|
||||
|
||||
type NativeFeatureFlags = NonNullable<typeof NativeReactNativeFeatureFlags>;
|
||||
|
||||
export function createNativeFlagGetter<K: keyof NativeFeatureFlags>(
|
||||
export function createNativeFlagGetter<K extends keyof NativeFeatureFlags>(
|
||||
configName: K,
|
||||
defaultValue: ReturnType<NonNullable<NativeFeatureFlags[K]>>,
|
||||
skipUnavailableNativeModuleError: boolean = false,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* If either style is null or undefined, the other one is returned without
|
||||
* allocating an array, saving allocations and enabling memoization.
|
||||
*/
|
||||
export default function composeStyles<T, U: T, V: T>(
|
||||
export default function composeStyles<T, U extends T, V extends T>(
|
||||
style1: ?U,
|
||||
style2: ?V,
|
||||
): ?(T | ReadonlyArray<T>) {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import type {HostInstance} from './HostInstance';
|
||||
|
||||
export type HostComponent<Config: {...}> = component(
|
||||
export type HostComponent<Config extends {...}> = component(
|
||||
ref?: React.RefSetter<HostInstance>,
|
||||
...Config
|
||||
);
|
||||
+1
-1
@@ -217,7 +217,7 @@ export default function structuredClone<T>(value: T): T {
|
||||
|
||||
const NON_SERIALIZABLE_OBJECT_KEY = Symbol('nonSerializableObject');
|
||||
|
||||
function isNonSerializableObject<T: interface {}>(obj: T): boolean {
|
||||
function isNonSerializableObject<T extends interface {}>(obj: T): boolean {
|
||||
// $FlowExpectedError[invalid-in-lhs]
|
||||
return NON_SERIALIZABLE_OBJECT_KEY in obj;
|
||||
}
|
||||
|
||||
@@ -17,11 +17,11 @@ const CLONE_PLATFORM_OBJECT_KEY = Symbol('clonePlatformObject');
|
||||
* Optionally, it sets the clone function for that platform object, which is a
|
||||
* simplification of the serializable attribute of the Web interface.
|
||||
*/
|
||||
export const setPlatformObject: (<T: interface {}>(
|
||||
export const setPlatformObject: (<T extends interface {}>(
|
||||
obj: Class<T>,
|
||||
options?: {clone: T => T},
|
||||
) => void) &
|
||||
(<T: interface {}>(obj: T, options?: {clone: T => T}) => void) =
|
||||
(<T extends interface {}>(obj: T, options?: {clone: T => T}) => void) =
|
||||
function setPlatformObject(obj, options) {
|
||||
if (typeof obj === 'function') {
|
||||
// $FlowExpectedError[prop-missing]
|
||||
@@ -43,7 +43,7 @@ export const setPlatformObject: (<T: interface {}>(
|
||||
/**
|
||||
* Indicates if the given object is a platform object.
|
||||
*/
|
||||
export function isPlatformObject<T: interface {}>(obj: T): boolean {
|
||||
export function isPlatformObject<T extends interface {}>(obj: T): boolean {
|
||||
// $FlowExpectedError[invalid-in-lhs]
|
||||
return IS_PLATFORM_OBJECT_KEY in obj;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ export function isPlatformObject<T: interface {}>(obj: T): boolean {
|
||||
/**
|
||||
* Returns the clone function for the given platform object, if it was set.
|
||||
*/
|
||||
export function getPlatformObjectClone<T: interface {}>(
|
||||
export function getPlatformObjectClone<T extends interface {}>(
|
||||
obj: T,
|
||||
): (T => T) | void {
|
||||
// $FlowExpectedError[prop-missing]
|
||||
|
||||
@@ -310,7 +310,7 @@ class TouchableHitSlop extends React.Component<{...}, $FlowFixMe> {
|
||||
}
|
||||
|
||||
function TouchableNativeMethodChecker<
|
||||
T: component(ref?: React.RefSetter<any>, ...any),
|
||||
T extends component(ref?: React.RefSetter<any>, ...any),
|
||||
>(props: {Component: T, name: string}): React.Node {
|
||||
const [status, setStatus] = useState<?boolean>(null);
|
||||
const ref = useRef<any>(null);
|
||||
|
||||
@@ -22,7 +22,7 @@ import * as React from 'react';
|
||||
*/
|
||||
export default class StateSafePureComponent<
|
||||
Props,
|
||||
State: interface {},
|
||||
State extends interface {},
|
||||
> extends React.PureComponent<Props, State> {
|
||||
_inAsyncStateUpdate = false;
|
||||
|
||||
@@ -32,7 +32,7 @@ export default class StateSafePureComponent<
|
||||
}
|
||||
|
||||
// $FlowFixMe[incompatible-type]
|
||||
setState<K: keyof State>(
|
||||
setState<K extends keyof State>(
|
||||
partialState: ?(Pick<State, K> | ((State, Props) => ?Pick<State, K>)),
|
||||
callback?: () => unknown,
|
||||
): void {
|
||||
|
||||
@@ -131,7 +131,7 @@ type State = {childProps: VirtualizedListProps, ...};
|
||||
*/
|
||||
class VirtualizedSectionList<
|
||||
ItemT,
|
||||
SectionT: SectionBase<
|
||||
SectionT extends SectionBase<
|
||||
ItemT,
|
||||
DefaultVirtualizedSectionT,
|
||||
> = DefaultVirtualizedSectionT,
|
||||
@@ -643,7 +643,7 @@ function ItemWithSeparator<ItemT>(
|
||||
|
||||
const VirtualizedSectionListComponent = VirtualizedSectionList as component<
|
||||
ItemT,
|
||||
SectionT: SectionBase<
|
||||
SectionT extends SectionBase<
|
||||
ItemT,
|
||||
DefaultVirtualizedSectionT,
|
||||
> = DefaultVirtualizedSectionT,
|
||||
|
||||
@@ -485,7 +485,7 @@ function getConfigurationVariations(
|
||||
return results;
|
||||
}
|
||||
|
||||
function parseFeatureFlagValue<T: boolean | number | string>(
|
||||
function parseFeatureFlagValue<T extends boolean | number | string>(
|
||||
defaultValue: T,
|
||||
value: string,
|
||||
): T {
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ export const MOCK_FN_TAG: symbol = Symbol('mock function');
|
||||
|
||||
// The type is defined this way because if we get a mixed value, we return
|
||||
// a generic mock function, and if we get a typed function, we get a typed mock.
|
||||
export const ensureMockFunction: (<TArgs: Array<unknown>, TReturn>(
|
||||
export const ensureMockFunction: (<TArgs extends Array<unknown>, TReturn>(
|
||||
fn: (...TArgs) => TReturn,
|
||||
) => JestMockFn<TArgs, TReturn>) &
|
||||
((fn: unknown) => JestMockFn<Array<unknown>, unknown>) = fn => {
|
||||
@@ -29,7 +29,7 @@ export const ensureMockFunction: (<TArgs: Array<unknown>, TReturn>(
|
||||
return fn;
|
||||
};
|
||||
|
||||
export function createMockFunction<TArgs: Array<unknown>, TReturn>(
|
||||
export function createMockFunction<TArgs extends Array<unknown>, TReturn>(
|
||||
initialImplementation?: (...TArgs) => TReturn,
|
||||
): JestMockFn<TArgs, TReturn> {
|
||||
let implementation: ?(...TArgs) => TReturn = initialImplementation;
|
||||
|
||||
Reference in new issue
Block a user