mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-30 10:35:22 +08:00
Replace some string[] arguments by ReadonlyArray<string>
`spawnSync`, `execFile`, ... take `string[]` as arguments which makes it inconvenient to pass a ReadonlyArray
This commit is contained in:
30
types/node/index.d.ts
vendored
30
types/node/index.d.ts
vendored
@@ -2253,33 +2253,33 @@ declare module "child_process" {
|
||||
|
||||
export function execFile(file: string): ChildProcess;
|
||||
export function execFile(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess;
|
||||
export function execFile(file: string, args: string[] | undefined | null): ChildProcess;
|
||||
export function execFile(file: string, args: string[] | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess;
|
||||
export function execFile(file: string, args?: ReadonlyArray<string> | null): ChildProcess;
|
||||
export function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null): ChildProcess;
|
||||
|
||||
// no `options` definitely means stdout/stderr are `string`.
|
||||
export function execFile(file: string, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
export function execFile(file: string, args: string[] | undefined | null, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
export function execFile(file: string, args: ReadonlyArray<string> | undefined | null, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
|
||||
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
|
||||
export function execFile(file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: Error | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
||||
export function execFile(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithBufferEncoding, callback: (error: Error | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
||||
export function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithBufferEncoding, callback: (error: Error | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
|
||||
|
||||
// `options` with well known `encoding` means stdout/stderr are definitely `string`.
|
||||
export function execFile(file: string, options: ExecFileOptionsWithStringEncoding, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
export function execFile(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithStringEncoding, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
export function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithStringEncoding, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
|
||||
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
|
||||
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
|
||||
export function execFile(file: string, options: ExecFileOptionsWithOtherEncoding, callback: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess;
|
||||
export function execFile(file: string, args: string[] | undefined | null, options: ExecFileOptionsWithOtherEncoding, callback: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess;
|
||||
export function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptionsWithOtherEncoding, callback: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess;
|
||||
|
||||
// `options` without an `encoding` means stdout/stderr are definitely `string`.
|
||||
export function execFile(file: string, options: ExecFileOptions, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
export function execFile(file: string, args: string[] | undefined | null, options: ExecFileOptions, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
export function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: ExecFileOptions, callback: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
|
||||
|
||||
// fallback if nothing else matches. Worst case is always `string | Buffer`.
|
||||
export function execFile(file: string, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null, callback: ((error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null): ChildProcess;
|
||||
export function execFile(file: string, args: string[] | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null, callback: ((error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null): ChildProcess;
|
||||
export function execFile(file: string, args: ReadonlyArray<string> | undefined | null, options: ({ encoding?: string | null } & ExecFileOptions) | undefined | null, callback: ((error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null): ChildProcess;
|
||||
|
||||
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
||||
export namespace execFile {
|
||||
@@ -2308,7 +2308,7 @@ declare module "child_process" {
|
||||
gid?: number;
|
||||
windowsVerbatimArguments?: boolean;
|
||||
}
|
||||
export function fork(modulePath: string, args?: string[], options?: ForkOptions): ChildProcess;
|
||||
export function fork(modulePath: string, args?: ReadonlyArray<string>, options?: ForkOptions): ChildProcess;
|
||||
|
||||
export interface SpawnSyncOptions {
|
||||
cwd?: string;
|
||||
@@ -2344,9 +2344,9 @@ declare module "child_process" {
|
||||
export function spawnSync(command: string, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
||||
export function spawnSync(command: string, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
||||
export function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
|
||||
export function spawnSync(command: string, args?: string[], options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
||||
export function spawnSync(command: string, args?: string[], options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
||||
export function spawnSync(command: string, args?: string[], options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
|
||||
export function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns<string>;
|
||||
export function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns<Buffer>;
|
||||
export function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<Buffer>;
|
||||
|
||||
export interface ExecSyncOptions {
|
||||
cwd?: string;
|
||||
@@ -2396,9 +2396,9 @@ declare module "child_process" {
|
||||
export function execFileSync(command: string, options?: ExecFileSyncOptionsWithStringEncoding): string;
|
||||
export function execFileSync(command: string, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
||||
export function execFileSync(command: string, options?: ExecFileSyncOptions): Buffer;
|
||||
export function execFileSync(command: string, args?: string[], options?: ExecFileSyncOptionsWithStringEncoding): string;
|
||||
export function execFileSync(command: string, args?: string[], options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
||||
export function execFileSync(command: string, args?: string[], options?: ExecFileSyncOptions): Buffer;
|
||||
export function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithStringEncoding): string;
|
||||
export function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptionsWithBufferEncoding): Buffer;
|
||||
export function execFileSync(command: string, args?: ReadonlyArray<string>, options?: ExecFileSyncOptions): Buffer;
|
||||
}
|
||||
|
||||
declare module "url" {
|
||||
|
||||
Reference in New Issue
Block a user