Improve types of synchronous methods (#678)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by ehmicky · committed by GitHub · parent 95e5754 · Browse files · 2 files·+411 added−231 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+411 added−231 removed
- other:+411 added−231 removed
Provenance
- Commit
698fbda- Tree
916a9d6- Author
ehmicky <ehmicky@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
95e5754
2 files changed+411 added−231 removed
modified:index.d.ts+130 added-162 removed
13 unmodified lines14 | undefined15 | URL16 | {file: string};17 18-type InputStdioOption =19- | Iterable<string | Uint8Array>18+type InputStdioOption<IsSync extends boolean = boolean> = IsSync extends true19+ ? Uint8Array20+ : Iterable<string | Uint8Array>21 | AsyncIterable<string | Uint8Array>22 | Uint8Array23 | Readable24 | ReadableStream;25 25-type OutputStdioOption =26- | Writable26+type OutputStdioOption<IsSync extends boolean = boolean> = IsSync extends true27+ ? never28+ : Writable29 | WritableStream;30 29-export type StdinOption =30- CommonStdioOption | InputStdioOption31- | Array<CommonStdioOption | InputStdioOption>;32-export type StdoutStderrOption =33- CommonStdioOption | OutputStdioOption34- | Array<CommonStdioOption | OutputStdioOption>;35-export type StdioOption =36- CommonStdioOption | InputStdioOption | OutputStdioOption37- | Array<CommonStdioOption | InputStdioOption | OutputStdioOption>;31+export type StdinOption<IsSync extends boolean = boolean> =32+ CommonStdioOption | InputStdioOption<IsSync>33+ | Array<CommonStdioOption | InputStdioOption<IsSync>>;34+export type StdoutStderrOption<IsSync extends boolean = boolean> =35+ CommonStdioOption | OutputStdioOption<IsSync>36+ | Array<CommonStdioOption | OutputStdioOption<IsSync>>;37+export type StdioOption<IsSync extends boolean = boolean> =38+ CommonStdioOption | InputStdioOption | OutputStdioOption<IsSync>39+ | Array<CommonStdioOption | InputStdioOption | OutputStdioOption<IsSync>>;40 39-type StdioOptions =41+type StdioOptions<IsSync extends boolean = boolean> =42 | BaseStdioOption41- | readonly [StdinOption, StdoutStderrOption, StdoutStderrOption, ...StdioOption[]];43+ | readonly [StdinOption<IsSync>, StdoutStderrOption<IsSync>, StdoutStderrOption<IsSync>, ...Array<StdioOption<IsSync>>];44 45 type EncodingOption =46 | 'utf8'47 // eslint-disable-next-line unicorn/text-encoding-identifier-case15 unmodified lines63 64 type GetStdoutStderrType<EncodingType extends EncodingOption> =65 EncodingType extends DefaultEncodingOption ? string : Uint8Array;66 65-export type CommonOptions<EncodingType extends EncodingOption = DefaultEncodingOption> = {67+export type Options<IsSync extends boolean = boolean, EncodingType extends EncodingOption = DefaultEncodingOption> = {68 /**67- Kill the spawned process when the parent process exits unless either:68- - the spawned process is [`detached`](https://nodejs.org/api/child_process.html#child_process_options_detached)69- - the parent process is terminated abruptly, for example, with `SIGKILL` as opposed to `SIGTERM` or a normal exit70-71- @default true72- */73- readonly cleanup?: boolean;74-75- /**69 Prefer locally installed binaries when looking for a binary to execute.70 71 If you `$ npm install foo`, you can then `execa('foo')`.72 21 unmodified lines94 */95 readonly execPath?: string | URL;96 97 /**105- Buffer the output from the spawned process. When set to `false`, you must read the output of `stdout` and `stderr` (or `all` if the `all` option is `true`). Otherwise the returned promise will not be resolved/rejected.98+ Write some input to the child process' `stdin`.99 107- If the spawned process fails, `error.stdout`, `error.stderr`, and `error.all` will contain the buffered data.100+ See also the `inputFile` and `stdin` options.101+ */102+ readonly input?: IsSync extends true ? string | Uint8Array : string | Uint8Array | Readable;103 109- @default true104+ /**105+ Use a file as input to the child process' `stdin`.106+107+ See also the `input` and `stdin` options.108 */111- readonly buffer?: boolean;109+ readonly inputFile?: string | URL;110 111 /**112 [How to setup](https://nodejs.org/api/child_process.html#child_process_options_stdio) the child process' standard input. This can be:113 - `'pipe'`: Sets [`childProcess.stdin`](https://nodejs.org/api/child_process.html#subprocessstdin) stream.12 unmodified lines126 This can be an [array of values](https://github.com/sindresorhus/execa#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.127 128 @default `inherit` with `$`, `pipe` otherwise129 */132- readonly stdin?: StdinOption;130+ readonly stdin?: StdinOption<IsSync>;131 132 /**133 [How to setup](https://nodejs.org/api/child_process.html#child_process_options_stdio) the child process' standard output. This can be:134 - `'pipe'`: Sets `childProcessResult.stdout` (as a string or `Uint8Array`) and [`childProcess.stdout`](https://nodejs.org/api/child_process.html#subprocessstdout) (as a stream).10 unmodified lines145 This can be an [array of values](https://github.com/sindresorhus/execa#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.146 147 @default 'pipe'148 */151- readonly stdout?: StdoutStderrOption;149+ readonly stdout?: StdoutStderrOption<IsSync>;150 151 /**152 [How to setup](https://nodejs.org/api/child_process.html#child_process_options_stdio) the child process' standard error. This can be:153 - `'pipe'`: Sets `childProcessResult.stderr` (as a string or `Uint8Array`) and [`childProcess.stderr`](https://nodejs.org/api/child_process.html#subprocessstderr) (as a stream).10 unmodified lines164 This can be an [array of values](https://github.com/sindresorhus/execa#redirect-stdinstdoutstderr-to-multiple-destinations) such as `['inherit', 'pipe']` or `[filePath, 'pipe']`.165 166 @default 'pipe'167 */170- readonly stderr?: StdoutStderrOption;168+ readonly stderr?: StdoutStderrOption<IsSync>;169 170 /**171 Like the `stdin`, `stdout` and `stderr` options but for all file descriptors at once. For example, `{stdio: ['ignore', 'pipe', 'pipe']}` is the same as `{stdin: 'ignore', stdout: 'pipe', stderr: 'pipe'}`.172 2 unmodified lines175 The array can have more than 3 items, to create additional file descriptors beyond `stdin`/`stdout`/`stderr`. For example, `{stdio: ['pipe', 'pipe', 'pipe', 'ipc']}` sets a fourth file descriptor `'ipc'`.176 177 @default 'pipe'178 */181- readonly stdio?: StdioOptions;179+ readonly stdio?: StdioOptions<IsSync>;180 181 /**182 Setting this to `false` resolves the promise with the error instead of rejecting it.183 1 unmodified line185 */186 readonly reject?: boolean;187 188 /**191- Add an `.all` property on the promise and the resolved value. The property contains the output of the process with `stdout` and `stderr` interleaved.192-193- @default false194- */195- readonly all?: boolean;196-197- /**189 Strip the final [newline character](https://en.wikipedia.org/wiki/Newline) from the output.190 191 @default true192 */25 unmodified lines218 */219 readonly argv0?: string;220 221 /**231- Specify the kind of serialization used for sending messages between processes when using the `stdio: 'ipc'` option or `execaNode()`:232- - `json`: Uses `JSON.stringify()` and `JSON.parse()`.233- - `advanced`: Uses [`v8.serialize()`](https://nodejs.org/api/v8.html#v8_v8_serialize_value)234-235- [More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)236-237- @default 'json'238- */239- readonly serialization?: 'json' | 'advanced';240-241- /**242- Prepare child to run independently of its parent process. Specific behavior [depends on the platform](https://nodejs.org/api/child_process.html#child_process_options_detached).243-244- @default false245- */246- readonly detached?: boolean;247-248- /**222 Sets the user identity of the process.223 */224 readonly uid?: number;225 42 unmodified lines268 */269 readonly killSignal?: string | number;270 271 /**299- You can abort the spawned process using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).300-301- When `AbortController.abort()` is called, [`.isCanceled`](https://github.com/sindresorhus/execa#iscanceled) becomes `true`.302-303- @example304- ```305- import {execa} from 'execa';306-307- const abortController = new AbortController();308- const subprocess = execa('node', [], {signal: abortController.signal});309-310- setTimeout(() => {311- abortController.abort();312- }, 1000);313-314- try {315- await subprocess;316- } catch (error) {317- console.log(error.isTerminated); // true318- console.log(error.isCanceled); // true319- }320- ```321- */322- readonly signal?: AbortSignal;323-324- /**272 If `true`, no quoting or escaping of arguments is done on Windows. Ignored on other platforms. This is set to `true` automatically when the `shell` option is `true`.273 274 @default false275 */13 unmodified lines289 290 @default false291 */292 readonly verbose?: boolean;346-};293+} & (IsSync extends true ? {} : {294+ /**295+ Kill the spawned process when the parent process exits unless either:296+ - the spawned process is [`detached`](https://nodejs.org/api/child_process.html#child_process_options_detached)297+ - the parent process is terminated abruptly, for example, with `SIGKILL` as opposed to `SIGTERM` or a normal exit298 348-export type Options<EncodingType extends EncodingOption = DefaultEncodingOption> = {299+ @default true300+ */301+ readonly cleanup?: boolean;302+303 /**350- Write some input to the child process' `stdin`.304+ Buffer the output from the spawned process. When set to `false`, you must read the output of `stdout` and `stderr` (or `all` if the `all` option is `true`). Otherwise the returned promise will not be resolved/rejected.305 352- See also the `inputFile` and `stdin` options.306+ If the spawned process fails, `error.stdout`, `error.stderr`, and `error.all` will contain the buffered data.307+308+ @default true309 */354- readonly input?: string | Uint8Array | Readable;310+ readonly buffer?: boolean;311 312 /**357- Use a file as input to the child process' `stdin`.313+ Add an `.all` property on the promise and the resolved value. The property contains the output of the process with `stdout` and `stderr` interleaved.314 359- See also the `input` and `stdin` options.315+ @default false316 */361- readonly inputFile?: string | URL;362-} & CommonOptions<EncodingType>;317+ readonly all?: boolean;318 364-export type SyncOptions<EncodingType extends EncodingOption = DefaultEncodingOption> = {319 /**366- Write some input to the `stdin` of your binary.320+ Specify the kind of serialization used for sending messages between processes when using the `stdio: 'ipc'` option or `execaNode()`:321+ - `json`: Uses `JSON.stringify()` and `JSON.parse()`.322+ - `advanced`: Uses [`v8.serialize()`](https://nodejs.org/api/v8.html#v8_v8_serialize_value)323 368- If the input is a file, use the `inputFile` option instead.324+ [More info.](https://nodejs.org/api/child_process.html#child_process_advanced_serialization)325+326+ @default 'json'327 */370- readonly input?: string | Uint8Array;328+ readonly serialization?: 'json' | 'advanced';329 330 /**373- Use a file as input to the the `stdin` of your binary.331+ Prepare child to run independently of its parent process. Specific behavior [depends on the platform](https://nodejs.org/api/child_process.html#child_process_options_detached).332 375- If the input is not a file, use the `input` option instead.333+ @default false334 */377- readonly inputFile?: string;378-} & CommonOptions<EncodingType>;335+ readonly detached?: boolean;336 337+ /**338+ You can abort the spawned process using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).339+340+ When `AbortController.abort()` is called, [`.isCanceled`](https://github.com/sindresorhus/execa#iscanceled) becomes `true`.341+342+ @example343+ ```344+ import {execa} from 'execa';345+346+ const abortController = new AbortController();347+ const subprocess = execa('node', [], {signal: abortController.signal});348+349+ setTimeout(() => {350+ abortController.abort();351+ }, 1000);352+353+ try {354+ await subprocess;355+ } catch (error) {356+ console.log(error.isTerminated); // true357+ console.log(error.isCanceled); // true358+ }359+ ```360+ */361+ readonly signal?: AbortSignal;362+});363+364+export type SyncOptions<EncodingType extends EncodingOption = DefaultEncodingOption> = Options<true, EncodingType>;365+366 export type NodeOptions<EncodingType extends EncodingOption = DefaultEncodingOption> = {367 /**368 The Node.js executable to use.369 6 unmodified lines376 377 @default process.execArgv378 */379 readonly nodeOptions?: string[];394-} & Options<EncodingType>;380+} & Options<false, EncodingType>;381 382 type StdoutStderrAll = string | Uint8Array | undefined;383 398-export type ExecaReturnBase<StdoutStderrType extends StdoutStderrAll> = {384+/**385+Result of a child process execution. On success this is a plain object. On failure this is also an `Error` instance.386+387+The child process fails when:388+- its exit code is not `0`389+- it was terminated with a signal390+- timing out391+- being canceled392+- there's not enough memory or there are already too many child processes393+*/394+export type ExecaReturnValue<IsSync extends boolean, StdoutStderrType extends StdoutStderrAll = string> = {395 /**396 The file and arguments that were run, for logging purposes.397 398 This is not escaped and should not be executed directly as a process, including using `execa()` or `execaCommand()`.65 unmodified lines464 /**465 The `cwd` of the command if provided in the command options. Otherwise it is `process.cwd()`.466 */467 cwd: string;472-};468 474-export type ExecaSyncReturnValue<StdoutStderrType extends StdoutStderrAll = string> = {475-} & ExecaReturnBase<StdoutStderrType>;469+ /**470+ Whether the process was canceled.471 477-/**478-Result of a child process execution. On success this is a plain object. On failure this is also an `Error` instance.479-480-The child process fails when:481-- its exit code is not `0`482-- it was terminated with a signal483-- timing out484-- being canceled485-- there's not enough memory or there are already too many child processes486-*/487-export type ExecaReturnValue<StdoutStderrType extends StdoutStderrAll = string> = {472+ You can cancel the spawned process using the [`signal`](https://github.com/sindresorhus/execa#signal-1) option.473+ */474+ isCanceled: boolean;475+} & (IsSync extends true ? {} : {476 /**477 The output of the process with `stdout` and `stderr` interleaved.478 479 This is `undefined` if either:480 - the `all` option is `false` (default value)493- - both `stdout` and `stderr` options are set to [`'inherit'`, `'ipc'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio)481+ - both `stdout` and `stderr` options are set to [`'inherit'`, `'ipc'`, `'ignore'`, `Stream` or `integer`](https://nodejs.org/api/child_process.html#child_process_options_stdio)482 */483 all?: StdoutStderrType;484+});485 497- /**498- Whether the process was canceled.486+type ExecaSyncReturnValue<StdoutStderrType extends StdoutStderrAll = string> = ExecaReturnValue<true, StdoutStderrType>;487 500- You can cancel the spawned process using the [`signal`](https://github.com/sindresorhus/execa#signal-1) option.501- */502- isCanceled: boolean;503-} & ExecaSyncReturnValue<StdoutStderrType>;504-505-export type ExecaSyncError<StdoutStderrType extends StdoutStderrAll = string> = {488+export type ExecaError<IsSync extends boolean = boolean, StdoutStderrType extends StdoutStderrAll = string> = {489 /**490 Error message when the child process failed to run. In addition to the underlying error message, it also contains some information related to why the child process errored.491 492 The child process `stderr` then `stdout` are appended to the end, separated with newlines and not interleaved.10 unmodified lines503 504 This is `undefined` unless the child process exited due to an `error` event or a timeout.505 */506 originalMessage?: string;524-} & Error & ExecaReturnBase<StdoutStderrType>;507+} & Error & ExecaReturnValue<IsSync, StdoutStderrType>;508 526-export type ExecaError<StdoutStderrType extends StdoutStderrAll = string> = {527- /**528- The output of the process with `stdout` and `stderr` interleaved.509+export type ExecaSyncError<StdoutStderrType extends StdoutStderrAll = string> = ExecaError<true, StdoutStderrType>;510 530- This is `undefined` if either:531- - the `all` option is `false` (default value)532- - `execaSync()` was used533- */534- all?: StdoutStderrType;535-536- /**537- Whether the process was canceled.538- */539- isCanceled: boolean;540-} & ExecaSyncError<StdoutStderrType>;541-511 export type KillOptions = {512 /**513 Milliseconds to wait for the child process to terminate before sending `SIGKILL`.514 14 unmodified lines529 */530 all?: Readable;531 532 catch<ResultType = never>(564- onRejected?: (reason: ExecaError<StdoutStderrType>) => ResultType | PromiseLike<ResultType>565- ): Promise<ExecaReturnValue<StdoutStderrType> | ResultType>;533+ onRejected?: (reason: ExecaError<false, StdoutStderrType>) => ResultType | PromiseLike<ResultType>534+ ): Promise<ExecaReturnValue<false, StdoutStderrType> | ResultType>;535 536 /**537 Same as the original [`child_process#kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal), except if `signal` is `SIGTERM` (the default value) and the child process is not terminated after 5 seconds, force it by sending `SIGKILL`. Note that this graceful termination does not work on Windows, because Windows [doesn't support signals](https://nodejs.org/api/process.html#process_signal_events) (`SIGKILL` and `SIGTERM` has the same effect of force-killing the process immediately.) If you want to achieve graceful termination on Windows, you have to use other means, such as [`taskkill`](https://github.com/sindresorhus/taskkill).538 */35 unmodified lines574 };575 576 export type ExecaChildProcess<StdoutStderrType extends StdoutStderrAll = string> = ChildProcess &577 ExecaChildPromise<StdoutStderrType> &609-Promise<ExecaReturnValue<StdoutStderrType>>;578+Promise<ExecaReturnValue<false, StdoutStderrType>>;579 580 /**581 Executes a command using `file ...arguments`. `file` is a string or a file URL. `arguments` are an array of strings. Returns a `childProcess`.582 107 unmodified lines690 */691 export function execa<EncodingType extends EncodingOption = DefaultEncodingOption>(692 file: string | URL,693 arguments?: readonly string[],725- options?: Options<EncodingType>694+ options?: Options<false, EncodingType>695 ): ExecaChildProcess<GetStdoutStderrType<EncodingType>>;696 export function execa<EncodingType extends EncodingOption = DefaultEncodingOption>(697 file: string | URL,729- options?: Options<EncodingType>698+ options?: Options<false, EncodingType>699 ): ExecaChildProcess<GetStdoutStderrType<EncodingType>>;700 701 /**702 Same as `execa()` but synchronous.59 unmodified lines762 */763 export function execaSync<EncodingType extends EncodingOption = DefaultEncodingOption>(764 file: string | URL,765 arguments?: readonly string[],797- options?: SyncOptions<EncodingType>798-): ExecaSyncReturnValue<GetStdoutStderrType<EncodingType>>;766+ options?: Options<true, EncodingType>767+): ExecaReturnValue<true, GetStdoutStderrType<EncodingType>>;768 export function execaSync<EncodingType extends EncodingOption = DefaultEncodingOption>(769 file: string | URL,801- options?: SyncOptions<EncodingType>802-): ExecaSyncReturnValue<GetStdoutStderrType<EncodingType>>;770+ options?: Options<true, EncodingType>771+): ExecaReturnValue<true, GetStdoutStderrType<EncodingType>>;772 773 /**774 Executes a command. The `command` string includes both the `file` and its `arguments`. Returns a `childProcess`.775 16 unmodified lines792 //=> 'unicorns'793 ```794 */795 export function execaCommand<EncodingType extends EncodingOption = DefaultEncodingOption>(827- command: string, options?: Options<EncodingType>796+ command: string, options?: Options<false, EncodingType>797 ): ExecaChildProcess<GetStdoutStderrType<EncodingType>>;798 799 /**800 Same as `execaCommand()` but synchronous.13 unmodified lines814 //=> 'unicorns'815 ```816 */817 export function execaCommandSync<EncodingType extends EncodingOption = DefaultEncodingOption>(849- command: string, options?: SyncOptions<EncodingType>850-): ExecaSyncReturnValue<GetStdoutStderrType<EncodingType>>;818+ command: string, options?: Options<true, EncodingType>819+): ExecaReturnValue<true, GetStdoutStderrType<EncodingType>>;820 821 type TemplateExpression =822 | string823 | number855- | ExecaReturnValue<string | Uint8Array>856- | ExecaSyncReturnValue<string | Uint8Array>857- | Array<string | number | ExecaReturnValue<string | Uint8Array> | ExecaSyncReturnValue<string | Uint8Array>>;824+ | ExecaReturnValue<boolean, string | Uint8Array>825+ | Array<string | number | ExecaReturnValue<boolean, string | Uint8Array>>;826 827 type Execa$<StdoutStderrType extends StdoutStderrAll = string> = {828 /**829 Returns a new instance of `$` but with different default `options`. Consecutive calls are merged to previous ones.17 unmodified lines847 await $$`echo rainbows`;848 //=> 'rainbows'849 ```850 */883- (options: Options<undefined>): Execa$<StdoutStderrType>;884- (options: Options): Execa$;885- (options: Options<BufferEncodingOption>): Execa$<Uint8Array>;851+ (options: Options<false, undefined>): Execa$<StdoutStderrType>;852+ (options: Options<false>): Execa$;853+ (options: Options<false, BufferEncodingOption>): Execa$<Uint8Array>;854 (855 templates: TemplateStringsArray,856 ...expressions: TemplateExpression[]857 ): ExecaChildProcess<StdoutStderrType>;47 unmodified lines905 */906 sync(907 templates: TemplateStringsArray,908 ...expressions: TemplateExpression[]941- ): ExecaSyncReturnValue<StdoutStderrType>;909+ ): ExecaReturnValue<true, StdoutStderrType>;910 911 /**912 Same as $\`command\` but synchronous.913 43 unmodified lines957 */958 s(959 templates: TemplateStringsArray,960 ...expressions: TemplateExpression[]993- ): ExecaSyncReturnValue<StdoutStderrType>;961+ ): ExecaReturnValue<true, StdoutStderrType>;962 };963 964 /**965 Executes a command. The `command` string includes both the `file` and its `arguments`. Returns a `childProcess`.88 unmodified linesmodified:index.test-d.ts+281 added-69 removed
2 unmodified lines3 // to get treated as `any` by `@typescript-eslint/no-unsafe-assignment`.4 import * as process from 'node:process';5 import {Readable, Writable} from 'node:stream';6 import {createWriteStream} from 'node:fs';7-import {expectType, expectError, expectAssignable} from 'tsd';7+import {expectType, expectError, expectAssignable, expectNotAssignable} from 'tsd';8 import {9 $,10 execa,11 execaSync,12 execaCommand,13 execaCommandSync,14 execaNode,15+ type Options,16 type ExecaReturnValue,17 type ExecaChildProcess,18 type ExecaError,19+ type SyncOptions,20 type ExecaSyncReturnValue,21 type ExecaSyncError,22 } from './index.js';23 49 unmodified lines73 expectType<string | undefined>(unicornsResult.signal);74 expectType<string | undefined>(unicornsResult.signalDescription);75 expectType<string>(unicornsResult.cwd);76 } catch (error: unknown) {75- const execaError = error as ExecaError;77+ const execaError = error as ExecaError<false>;78 79 expectType<string>(execaError.message);80 expectType<number | undefined>(execaError.exitCode);81 expectType<string>(execaError.stdout);11 unmodified lines93 }94 95 try {96 const unicornsResult = execaSync('unicorns');97+ expectType<ExecaSyncReturnValue>(unicornsResult);98 expectType<string>(unicornsResult.command);99 expectType<string>(unicornsResult.escapedCommand);100 expectType<number | undefined>(unicornsResult.exitCode);101 expectType<string>(unicornsResult.stdout);3 unmodified lines105 expectError(unicornsResult.pipeStderr);106 expectError(unicornsResult.pipeAll);107 expectType<boolean>(unicornsResult.failed);108 expectType<boolean>(unicornsResult.timedOut);106- expectError(unicornsResult.isCanceled);109+ expectType<boolean>(unicornsResult.isCanceled);110 expectType<boolean>(unicornsResult.isTerminated);111 expectType<string | undefined>(unicornsResult.signal);112 expectType<string | undefined>(unicornsResult.signalDescription);113 expectType<string>(unicornsResult.cwd);114 } catch (error: unknown) {112- const execaError = error as ExecaSyncError;115+ const execaError = error as ExecaError<true>;116 117+ expectType<ExecaSyncError>(execaError);118 expectType<string>(execaError.message);119 expectType<number | undefined>(execaError.exitCode);120 expectType<string>(execaError.stdout);121 expectType<string>(execaError.stderr);122 expectError(execaError.all);123 expectType<boolean>(execaError.failed);124 expectType<boolean>(execaError.timedOut);121- expectError(execaError.isCanceled);125+ expectType<boolean>(execaError.isCanceled);126 expectType<boolean>(execaError.isTerminated);127 expectType<string | undefined>(execaError.signal);128 expectType<string | undefined>(execaError.signalDescription);129 expectType<string>(execaError.cwd);18 unmodified lines148 };149 150 const fileUrl = new URL('file:///test');151 152+expectAssignable<Options>({cleanup: false});153+expectNotAssignable<SyncOptions>({cleanup: false});154+expectAssignable<SyncOptions>({preferLocal: false});155+156 /* eslint-disable @typescript-eslint/no-floating-promises */157 execa('unicorns', {cleanup: false});158+expectError(execaSync('unicorns', {cleanup: false}));159 execa('unicorns', {preferLocal: false});160+execaSync('unicorns', {preferLocal: false});161 execa('unicorns', {localDir: '.'});162+execaSync('unicorns', {localDir: '.'});163 execa('unicorns', {localDir: fileUrl});164+execaSync('unicorns', {localDir: fileUrl});165 expectError(execa('unicorns', {encoding: 'unknownEncoding'}));166+expectError(execaSync('unicorns', {encoding: 'unknownEncoding'}));167 execa('unicorns', {execPath: '/path'});168+execaSync('unicorns', {execPath: '/path'});169 execa('unicorns', {execPath: fileUrl});170+execaSync('unicorns', {execPath: fileUrl});171 execa('unicorns', {buffer: false});172+expectError(execaSync('unicorns', {buffer: false}));173 execa('unicorns', {input: ''});174+execaSync('unicorns', {input: ''});175 execa('unicorns', {input: new Uint8Array()});176+execaSync('unicorns', {input: new Uint8Array()});177 execa('unicorns', {input: process.stdin});178+expectError(execaSync('unicorns', {input: process.stdin}));179 execa('unicorns', {inputFile: ''});180+execaSync('unicorns', {inputFile: ''});181 execa('unicorns', {inputFile: fileUrl});182+execaSync('unicorns', {inputFile: fileUrl});183 execa('unicorns', {stdin: 'pipe'});184+execaSync('unicorns', {stdin: 'pipe'});185 execa('unicorns', {stdin: ['pipe']});186+execaSync('unicorns', {stdin: ['pipe']});187 execa('unicorns', {stdin: 'overlapped'});188+execaSync('unicorns', {stdin: 'overlapped'});189 execa('unicorns', {stdin: ['overlapped']});190+execaSync('unicorns', {stdin: ['overlapped']});191 execa('unicorns', {stdin: 'ipc'});192+execaSync('unicorns', {stdin: 'ipc'});193 execa('unicorns', {stdin: ['ipc']});194+execaSync('unicorns', {stdin: ['ipc']});195 execa('unicorns', {stdin: 'ignore'});196+execaSync('unicorns', {stdin: 'ignore'});197 execa('unicorns', {stdin: ['ignore']});198+execaSync('unicorns', {stdin: ['ignore']});199 execa('unicorns', {stdin: 'inherit'});200+execaSync('unicorns', {stdin: 'inherit'});201 execa('unicorns', {stdin: ['inherit']});202+execaSync('unicorns', {stdin: ['inherit']});203 execa('unicorns', {stdin: process.stdin});204+expectError(execaSync('unicorns', {stdin: process.stdin}));205 execa('unicorns', {stdin: [process.stdin]});206+expectError(execaSync('unicorns', {stdin: [process.stdin]}));207 execa('unicorns', {stdin: new Readable()});208+expectError(execaSync('unicorns', {stdin: new Readable()}));209 execa('unicorns', {stdin: [new Readable()]});210+expectError(execaSync('unicorns', {stdin: [new Readable()]}));211 expectError(execa('unicorns', {stdin: new Writable()}));212+expectError(execaSync('unicorns', {stdin: new Writable()}));213 expectError(execa('unicorns', {stdin: [new Writable()]}));214+expectError(execaSync('unicorns', {stdin: [new Writable()]}));215 execa('unicorns', {stdin: new ReadableStream()});216+expectError(execaSync('unicorns', {stdin: new ReadableStream()}));217 execa('unicorns', {stdin: [new ReadableStream()]});218+expectError(execaSync('unicorns', {stdin: [new ReadableStream()]}));219 expectError(execa('unicorns', {stdin: new WritableStream()}));220+expectError(execaSync('unicorns', {stdin: new WritableStream()}));221 expectError(execa('unicorns', {stdin: [new WritableStream()]}));222+expectError(execaSync('unicorns', {stdin: [new WritableStream()]}));223 execa('unicorns', {stdin: new Uint8Array()});224+execaSync('unicorns', {stdin: new Uint8Array()});225 execa('unicorns', {stdin: stringGenerator()});226+expectError(execaSync('unicorns', {stdin: stringGenerator()}));227 execa('unicorns', {stdin: [stringGenerator()]});228+expectError(execaSync('unicorns', {stdin: [stringGenerator()]}));229 execa('unicorns', {stdin: binaryGenerator()});230+expectError(execaSync('unicorns', {stdin: binaryGenerator()}));231 execa('unicorns', {stdin: [binaryGenerator()]});232+expectError(execaSync('unicorns', {stdin: [binaryGenerator()]}));233 execa('unicorns', {stdin: asyncStringGenerator()});234+expectError(execaSync('unicorns', {stdin: asyncStringGenerator()}));235 execa('unicorns', {stdin: [asyncStringGenerator()]});236+expectError(execaSync('unicorns', {stdin: [asyncStringGenerator()]}));237 expectError(execa('unicorns', {stdin: numberGenerator()}));238+expectError(execaSync('unicorns', {stdin: numberGenerator()}));239 expectError(execa('unicorns', {stdin: [numberGenerator()]}));240+expectError(execaSync('unicorns', {stdin: [numberGenerator()]}));241 execa('unicorns', {stdin: fileUrl});242+execaSync('unicorns', {stdin: fileUrl});243 execa('unicorns', {stdin: [fileUrl]});244+execaSync('unicorns', {stdin: [fileUrl]});245 execa('unicorns', {stdin: {file: './test'}});246+execaSync('unicorns', {stdin: {file: './test'}});247 execa('unicorns', {stdin: [{file: './test'}]});248+execaSync('unicorns', {stdin: [{file: './test'}]});249 execa('unicorns', {stdin: 1});250+execaSync('unicorns', {stdin: 1});251 execa('unicorns', {stdin: [1]});252+execaSync('unicorns', {stdin: [1]});253 execa('unicorns', {stdin: undefined});254+execaSync('unicorns', {stdin: undefined});255 execa('unicorns', {stdin: [undefined]});256+execaSync('unicorns', {stdin: [undefined]});257 execa('unicorns', {stdin: ['pipe', 'inherit']});258+execaSync('unicorns', {stdin: ['pipe', 'inherit']});259 execa('unicorns', {stdout: 'pipe'});260+execaSync('unicorns', {stdout: 'pipe'});261 execa('unicorns', {stdout: ['pipe']});262+execaSync('unicorns', {stdout: ['pipe']});263 execa('unicorns', {stdout: 'overlapped'});264+execaSync('unicorns', {stdout: 'overlapped'});265 execa('unicorns', {stdout: ['overlapped']});266+execaSync('unicorns', {stdout: ['overlapped']});267 execa('unicorns', {stdout: 'ipc'});268+execaSync('unicorns', {stdout: 'ipc'});269 execa('unicorns', {stdout: ['ipc']});270+execaSync('unicorns', {stdout: ['ipc']});271 execa('unicorns', {stdout: 'ignore'});272+execaSync('unicorns', {stdout: 'ignore'});273 execa('unicorns', {stdout: ['ignore']});274+execaSync('unicorns', {stdout: ['ignore']});275 execa('unicorns', {stdout: 'inherit'});276+execaSync('unicorns', {stdout: 'inherit'});277 execa('unicorns', {stdout: ['inherit']});278+execaSync('unicorns', {stdout: ['inherit']});279 execa('unicorns', {stdout: process.stdout});280+expectError(execaSync('unicorns', {stdout: process.stdout}));281 execa('unicorns', {stdout: [process.stdout]});282+expectError(execaSync('unicorns', {stdout: [process.stdout]}));283 execa('unicorns', {stdout: new Writable()});284+expectError(execaSync('unicorns', {stdout: new Writable()}));285 execa('unicorns', {stdout: [new Writable()]});286+expectError(execaSync('unicorns', {stdout: [new Writable()]}));287 expectError(execa('unicorns', {stdout: new Readable()}));288+expectError(execaSync('unicorns', {stdout: new Readable()}));289 expectError(execa('unicorn', {stdout: [new Readable()]}));290+expectError(execaSync('unicorn', {stdout: [new Readable()]}));291 execa('unicorns', {stdout: new WritableStream()});292+expectError(execaSync('unicorns', {stdout: new WritableStream()}));293 execa('unicorns', {stdout: [new WritableStream()]});294+expectError(execaSync('unicorns', {stdout: [new WritableStream()]}));295 expectError(execa('unicorns', {stdout: new ReadableStream()}));296+expectError(execaSync('unicorns', {stdout: new ReadableStream()}));297 expectError(execa('unicorn', {stdout: [new ReadableStream()]}));298+expectError(execaSync('unicorn', {stdout: [new ReadableStream()]}));299 execa('unicorns', {stdout: fileUrl});300+execaSync('unicorns', {stdout: fileUrl});301 execa('unicorns', {stdout: [fileUrl]});302+execaSync('unicorns', {stdout: [fileUrl]});303 execa('unicorns', {stdout: {file: './test'}});304+execaSync('unicorns', {stdout: {file: './test'}});305 execa('unicorns', {stdout: [{file: './test'}]});306+execaSync('unicorns', {stdout: [{file: './test'}]});307 execa('unicorns', {stdout: 1});308+execaSync('unicorns', {stdout: 1});309 execa('unicorns', {stdout: [1]});310+execaSync('unicorns', {stdout: [1]});311 execa('unicorns', {stdout: undefined});312+execaSync('unicorns', {stdout: undefined});313 execa('unicorns', {stdout: [undefined]});314+execaSync('unicorns', {stdout: [undefined]});315 execa('unicorns', {stdout: ['pipe', 'inherit']});316+execaSync('unicorns', {stdout: ['pipe', 'inherit']});317 execa('unicorns', {stderr: 'pipe'});318+execaSync('unicorns', {stderr: 'pipe'});319 execa('unicorns', {stderr: ['pipe']});320+execaSync('unicorns', {stderr: ['pipe']});321 execa('unicorns', {stderr: 'overlapped'});322+execaSync('unicorns', {stderr: 'overlapped'});323 execa('unicorns', {stderr: ['overlapped']});324+execaSync('unicorns', {stderr: ['overlapped']});325 execa('unicorns', {stderr: 'ipc'});326+execaSync('unicorns', {stderr: 'ipc'});327 execa('unicorns', {stderr: ['ipc']});328+execaSync('unicorns', {stderr: ['ipc']});329 execa('unicorns', {stderr: 'ignore'});330+execaSync('unicorns', {stderr: 'ignore'});331 execa('unicorns', {stderr: ['ignore']});332+execaSync('unicorns', {stderr: ['ignore']});333 execa('unicorns', {stderr: 'inherit'});334+execaSync('unicorns', {stderr: 'inherit'});335 execa('unicorns', {stderr: ['inherit']});336+execaSync('unicorns', {stderr: ['inherit']});337 execa('unicorns', {stderr: process.stderr});338+expectError(execaSync('unicorns', {stderr: process.stderr}));339 execa('unicorns', {stderr: [process.stderr]});340+expectError(execaSync('unicorns', {stderr: [process.stderr]}));341 execa('unicorns', {stderr: new Writable()});342+expectError(execaSync('unicorns', {stderr: new Writable()}));343 execa('unicorns', {stderr: [new Writable()]});344+expectError(execaSync('unicorns', {stderr: [new Writable()]}));345 expectError(execa('unicorns', {stderr: new Readable()}));346+expectError(execaSync('unicorns', {stderr: new Readable()}));347 expectError(execa('unicorns', {stderr: [new Readable()]}));348+expectError(execaSync('unicorns', {stderr: [new Readable()]}));349 execa('unicorns', {stderr: new WritableStream()});350+expectError(execaSync('unicorns', {stderr: new WritableStream()}));351 execa('unicorns', {stderr: [new WritableStream()]});352+expectError(execaSync('unicorns', {stderr: [new WritableStream()]}));353 expectError(execa('unicorns', {stderr: new ReadableStream()}));354+expectError(execaSync('unicorns', {stderr: new ReadableStream()}));355 expectError(execa('unicorns', {stderr: [new ReadableStream()]}));356+expectError(execaSync('unicorns', {stderr: [new ReadableStream()]}));357 execa('unicorns', {stderr: fileUrl});358+execaSync('unicorns', {stderr: fileUrl});359 execa('unicorns', {stderr: [fileUrl]});360+execaSync('unicorns', {stderr: [fileUrl]});361 execa('unicorns', {stderr: {file: './test'}});362+execaSync('unicorns', {stderr: {file: './test'}});363 execa('unicorns', {stderr: [{file: './test'}]});364+execaSync('unicorns', {stderr: [{file: './test'}]});365 execa('unicorns', {stderr: 1});366+execaSync('unicorns', {stderr: 1});367 execa('unicorns', {stderr: [1]});368+execaSync('unicorns', {stderr: [1]});369 execa('unicorns', {stderr: undefined});370+execaSync('unicorns', {stderr: undefined});371 execa('unicorns', {stderr: [undefined]});372+execaSync('unicorns', {stderr: [undefined]});373 execa('unicorns', {stderr: ['pipe', 'inherit']});374+execaSync('unicorns', {stderr: ['pipe', 'inherit']});375 execa('unicorns', {all: true});376+expectError(execaSync('unicorns', {all: true}));377 execa('unicorns', {reject: false});378+execaSync('unicorns', {reject: false});379 execa('unicorns', {stripFinalNewline: false});380+execaSync('unicorns', {stripFinalNewline: false});381 execa('unicorns', {extendEnv: false});382+execaSync('unicorns', {extendEnv: false});383 execa('unicorns', {cwd: '.'});384+execaSync('unicorns', {cwd: '.'});385 execa('unicorns', {cwd: fileUrl});386+execaSync('unicorns', {cwd: fileUrl});387 // eslint-disable-next-line @typescript-eslint/naming-convention388 execa('unicorns', {env: {PATH: ''}});389+// eslint-disable-next-line @typescript-eslint/naming-convention390+execaSync('unicorns', {env: {PATH: ''}});391 execa('unicorns', {argv0: ''});392+execaSync('unicorns', {argv0: ''});393 execa('unicorns', {stdio: 'pipe'});394+execaSync('unicorns', {stdio: 'pipe'});395 execa('unicorns', {stdio: 'overlapped'});396+execaSync('unicorns', {stdio: 'overlapped'});397 execa('unicorns', {stdio: 'ignore'});398+execaSync('unicorns', {stdio: 'ignore'});399 execa('unicorns', {stdio: 'inherit'});400+execaSync('unicorns', {stdio: 'inherit'});401 expectError(execa('unicorns', {stdio: 'ipc'}));402+expectError(execaSync('unicorns', {stdio: 'ipc'}));403 expectError(execa('unicorns', {stdio: 1}));404+expectError(execaSync('unicorns', {stdio: 1}));405 expectError(execa('unicorns', {stdio: fileUrl}));406+expectError(execaSync('unicorns', {stdio: fileUrl}));407 expectError(execa('unicorns', {stdio: {file: './test'}}));408+expectError(execaSync('unicorns', {stdio: {file: './test'}}));409 expectError(execa('unicorns', {stdio: new Writable()}));410+expectError(execaSync('unicorns', {stdio: new Writable()}));411 expectError(execa('unicorns', {stdio: new Readable()}));412+expectError(execaSync('unicorns', {stdio: new Readable()}));413 expectError(execa('unicorns', {stdio: new WritableStream()}));414+expectError(execaSync('unicorns', {stdio: new WritableStream()}));415 expectError(execa('unicorns', {stdio: new ReadableStream()}));416+expectError(execaSync('unicorns', {stdio: new ReadableStream()}));417 expectError(execa('unicorns', {stdio: stringGenerator()}));418+expectError(execaSync('unicorns', {stdio: stringGenerator()}));419 expectError(execa('unicorns', {stdio: asyncStringGenerator()}));420+expectError(execaSync('unicorns', {stdio: asyncStringGenerator()}));421 expectError(execa('unicorns', {stdio: ['pipe', 'pipe']}));422+expectError(execaSync('unicorns', {stdio: ['pipe', 'pipe']}));423 execa('unicorns', {stdio: [new Readable(), 'pipe', 'pipe']});424+expectError(execaSync('unicorns', {stdio: [new Readable(), 'pipe', 'pipe']}));425 execa('unicorns', {stdio: [[new Readable()], ['pipe'], ['pipe']]});426+expectError(execaSync('unicorns', {stdio: [[new Readable()], ['pipe'], ['pipe']]}));427 execa('unicorns', {stdio: ['pipe', new Writable(), 'pipe']});428+expectError(execaSync('unicorns', {stdio: ['pipe', new Writable(), 'pipe']}));429 execa('unicorns', {stdio: [['pipe'], [new Writable()], ['pipe']]});430+expectError(execaSync('unicorns', {stdio: [['pipe'], [new Writable()], ['pipe']]}));431 execa('unicorns', {stdio: ['pipe', 'pipe', new Writable()]});432+expectError(execaSync('unicorns', {stdio: ['pipe', 'pipe', new Writable()]}));433 execa('unicorns', {stdio: [['pipe'], ['pipe'], [new Writable()]]});434+expectError(execaSync('unicorns', {stdio: [['pipe'], ['pipe'], [new Writable()]]}));435 expectError(execa('unicorns', {stdio: [new Writable(), 'pipe', 'pipe']}));436+expectError(execaSync('unicorns', {stdio: [new Writable(), 'pipe', 'pipe']}));437 expectError(execa('unicorns', {stdio: [[new Writable()], ['pipe'], ['pipe']]}));438+expectError(execaSync('unicorns', {stdio: [[new Writable()], ['pipe'], ['pipe']]}));439 expectError(execa('unicorns', {stdio: ['pipe', new Readable(), 'pipe']}));440+expectError(execaSync('unicorns', {stdio: ['pipe', new Readable(), 'pipe']}));441 expectError(execa('unicorns', {stdio: [['pipe'], [new Readable()], ['pipe']]}));442+expectError(execaSync('unicorns', {stdio: [['pipe'], [new Readable()], ['pipe']]}));443 expectError(execa('unicorns', {stdio: ['pipe', 'pipe', new Readable()]}));444+expectError(execaSync('unicorns', {stdio: ['pipe', 'pipe', new Readable()]}));445 expectError(execa('unicorns', {stdio: [['pipe'], ['pipe'], [new Readable()]]}));446+expectError(execaSync('unicorns', {stdio: [['pipe'], ['pipe'], [new Readable()]]}));447 execa('unicorns', {448 stdio: [449 'pipe',450 'overlapped',13 unmodified lines464 stringGenerator(),465 asyncStringGenerator(),466 ],467 });468+execaSync('unicorns', {469+ stdio: [470+ 'pipe',471+ 'overlapped',472+ 'ipc',473+ 'ignore',474+ 'inherit',475+ process.stdin,476+ 1,477+ undefined,478+ fileUrl,479+ {file: './test'},480+ new Uint8Array(),481+ ],482+});483+expectError(execaSync('unicorns', {stdio: [new Writable()]}));484+expectError(execaSync('unicorns', {stdio: [new Readable()]}));485+expectError(execaSync('unicorns', {stdio: [new WritableStream()]}));486+expectError(execaSync('unicorns', {stdio: [new ReadableStream()]}));487+expectError(execaSync('unicorns', {stdio: [stringGenerator()]}));488+expectError(execaSync('unicorns', {stdio: [asyncStringGenerator()]}));489 execa('unicorns', {490 stdio: [491 ['pipe'],492 ['pipe', 'inherit'],9 unmodified lines502 [new Writable()],503 [new Readable()],504 [new WritableStream()],505 [new ReadableStream()],506+ [new Uint8Array()],507 [stringGenerator()],508 [asyncStringGenerator()],509 ],510 });511+execaSync('unicorns', {512+ stdio: [513+ ['pipe'],514+ ['pipe', 'inherit'],515+ ['overlapped'],516+ ['ipc'],517+ ['ignore'],518+ ['inherit'],519+ [process.stdin],520+ [1],521+ [undefined],522+ [fileUrl],523+ [{file: './test'}],524+ [new Uint8Array()],525+ ],526+});527+expectError(execaSync('unicorns', {stdio: [[new Writable()]]}));528+expectError(execaSync('unicorns', {stdio: [[new Readable()]]}));529+expectError(execaSync('unicorns', {stdio: [[new WritableStream()]]}));530+expectError(execaSync('unicorns', {stdio: [[new ReadableStream()]]}));531+expectError(execaSync('unicorns', {stdio: [[stringGenerator()]]}));532+expectError(execaSync('unicorns', {stdio: [[asyncStringGenerator()]]}));533 execa('unicorns', {serialization: 'advanced'});534+expectError(execaSync('unicorns', {serialization: 'advanced'}));535 execa('unicorns', {detached: true});536+expectError(execaSync('unicorns', {detached: true}));537 execa('unicorns', {uid: 0});538+execaSync('unicorns', {uid: 0});539 execa('unicorns', {gid: 0});540+execaSync('unicorns', {gid: 0});541 execa('unicorns', {shell: true});542+execaSync('unicorns', {shell: true});543 execa('unicorns', {shell: '/bin/sh'});544+execaSync('unicorns', {shell: '/bin/sh'});545 execa('unicorns', {shell: fileUrl});546+execaSync('unicorns', {shell: fileUrl});547 execa('unicorns', {timeout: 1000});548+execaSync('unicorns', {timeout: 1000});549 execa('unicorns', {maxBuffer: 1000});550+execaSync('unicorns', {maxBuffer: 1000});551 execa('unicorns', {killSignal: 'SIGTERM'});552+execaSync('unicorns', {killSignal: 'SIGTERM'});553 execa('unicorns', {killSignal: 9});554+execaSync('unicorns', {killSignal: 9});555 execa('unicorns', {signal: new AbortController().signal});556+expectError(execaSync('unicorns', {signal: new AbortController().signal}));557 execa('unicorns', {windowsVerbatimArguments: true});558+execaSync('unicorns', {windowsVerbatimArguments: true});559 execa('unicorns', {windowsHide: false});560+execaSync('unicorns', {windowsHide: false});561 execa('unicorns', {verbose: false});562+execaSync('unicorns', {verbose: false});563 /* eslint-enable @typescript-eslint/no-floating-promises */564 execa('unicorns').kill();565 execa('unicorns').kill('SIGKILL');566 execa('unicorns').kill(undefined);4 unmodified lines571 572 expectError(execa(['unicorns', 'arg']));573 expectType<ExecaChildProcess>(execa('unicorns'));574 expectType<ExecaChildProcess>(execa(fileUrl));363-expectType<ExecaReturnValue>(await execa('unicorns'));364-expectType<ExecaReturnValue>(575+expectType<ExecaReturnValue<false>>(await execa('unicorns'));576+expectType<ExecaReturnValue<false>>(577 await execa('unicorns', {encoding: 'utf8'}),578 );367-expectType<ExecaReturnValue<Uint8Array>>(await execa('unicorns', {encoding: 'buffer'}));368-expectType<ExecaReturnValue>(579+expectType<ExecaReturnValue<false, Uint8Array>>(await execa('unicorns', {encoding: 'buffer'}));580+expectType<ExecaReturnValue<false>>(581 await execa('unicorns', ['foo'], {encoding: 'utf8'}),582 );371-expectType<ExecaReturnValue<Uint8Array>>(583+expectType<ExecaReturnValue<false, Uint8Array>>(584 await execa('unicorns', ['foo'], {encoding: 'buffer'}),585 );586 587 expectError(execaSync(['unicorns', 'arg']));376-expectType<ExecaSyncReturnValue>(execaSync('unicorns'));377-expectType<ExecaSyncReturnValue>(execaSync(fileUrl));378-expectType<ExecaSyncReturnValue>(588+expectType<ExecaReturnValue<true>>(execaSync('unicorns'));589+expectType<ExecaReturnValue<true>>(execaSync(fileUrl));590+expectType<ExecaReturnValue<true>>(591 execaSync('unicorns', {encoding: 'utf8'}),592 );381-expectType<ExecaSyncReturnValue<Uint8Array>>(593+expectType<ExecaReturnValue<true, Uint8Array>>(594 execaSync('unicorns', {encoding: 'buffer'}),595 );384-expectType<ExecaSyncReturnValue>(596+expectType<ExecaReturnValue<true>>(597 execaSync('unicorns', ['foo'], {encoding: 'utf8'}),598 );387-expectType<ExecaSyncReturnValue<Uint8Array>>(599+expectType<ExecaReturnValue<true, Uint8Array>>(600 execaSync('unicorns', ['foo'], {encoding: 'buffer'}),601 );602 603 expectType<ExecaChildProcess>(execaCommand('unicorns'));392-expectType<ExecaReturnValue>(await execaCommand('unicorns'));393-expectType<ExecaReturnValue>(await execaCommand('unicorns', {encoding: 'utf8'}));394-expectType<ExecaReturnValue<Uint8Array>>(await execaCommand('unicorns', {encoding: 'buffer'}));395-expectType<ExecaReturnValue>(await execaCommand('unicorns foo', {encoding: 'utf8'}));396-expectType<ExecaReturnValue<Uint8Array>>(await execaCommand('unicorns foo', {encoding: 'buffer'}));604+expectType<ExecaReturnValue<false>>(await execaCommand('unicorns'));605+expectType<ExecaReturnValue<false>>(await execaCommand('unicorns', {encoding: 'utf8'}));606+expectType<ExecaReturnValue<false, Uint8Array>>(await execaCommand('unicorns', {encoding: 'buffer'}));607+expectType<ExecaReturnValue<false>>(await execaCommand('unicorns foo', {encoding: 'utf8'}));608+expectType<ExecaReturnValue<false, Uint8Array>>(await execaCommand('unicorns foo', {encoding: 'buffer'}));609 398-expectType<ExecaSyncReturnValue>(execaCommandSync('unicorns'));399-expectType<ExecaSyncReturnValue>(execaCommandSync('unicorns', {encoding: 'utf8'}));400-expectType<ExecaSyncReturnValue<Uint8Array>>(execaCommandSync('unicorns', {encoding: 'buffer'}));401-expectType<ExecaSyncReturnValue>(execaCommandSync('unicorns foo', {encoding: 'utf8'}));402-expectType<ExecaSyncReturnValue<Uint8Array>>(execaCommandSync('unicorns foo', {encoding: 'buffer'}));610+expectType<ExecaReturnValue<true>>(execaCommandSync('unicorns'));611+expectType<ExecaReturnValue<true>>(execaCommandSync('unicorns', {encoding: 'utf8'}));612+expectType<ExecaReturnValue<true, Uint8Array>>(execaCommandSync('unicorns', {encoding: 'buffer'}));613+expectType<ExecaReturnValue<true>>(execaCommandSync('unicorns foo', {encoding: 'utf8'}));614+expectType<ExecaReturnValue<true, Uint8Array>>(execaCommandSync('unicorns foo', {encoding: 'buffer'}));615 616 expectError(execaNode(['unicorns', 'arg']));617 expectType<ExecaChildProcess>(execaNode('unicorns'));406-expectType<ExecaReturnValue>(await execaNode('unicorns'));407-expectType<ExecaReturnValue>(await execaNode(fileUrl));408-expectType<ExecaReturnValue>(618+expectType<ExecaReturnValue<false>>(await execaNode('unicorns'));619+expectType<ExecaReturnValue<false>>(await execaNode(fileUrl));620+expectType<ExecaReturnValue<false>>(621 await execaNode('unicorns', {encoding: 'utf8'}),622 );411-expectType<ExecaReturnValue<Uint8Array>>(await execaNode('unicorns', {encoding: 'buffer'}));412-expectType<ExecaReturnValue>(623+expectType<ExecaReturnValue<false, Uint8Array>>(await execaNode('unicorns', {encoding: 'buffer'}));624+expectType<ExecaReturnValue<false>>(625 await execaNode('unicorns', ['foo'], {encoding: 'utf8'}),626 );415-expectType<ExecaReturnValue<Uint8Array>>(627+expectType<ExecaReturnValue<false, Uint8Array>>(628 await execaNode('unicorns', ['foo'], {encoding: 'buffer'}),629 );630 631 expectType<ExecaChildProcess>(execaNode('unicorns', {nodePath: './node'}));8 unmodified lines640 execaNode('unicorns', ['foo'], {nodeOptions: ['--async-stack-traces'], encoding: 'buffer'}),641 );642 643 expectType<ExecaChildProcess>($`unicorns`);432-expectType<ExecaReturnValue>(await $`unicorns`);433-expectType<ExecaSyncReturnValue>($.sync`unicorns`);434-expectType<ExecaSyncReturnValue>($.s`unicorns`);644+expectType<ExecaReturnValue<false>>(await $`unicorns`);645+expectType<ExecaReturnValue<true>>($.sync`unicorns`);646+expectType<ExecaReturnValue<true>>($.s`unicorns`);647 648 expectType<ExecaChildProcess>($({encoding: 'utf8'})`unicorns`);437-expectType<ExecaReturnValue>(await $({encoding: 'utf8'})`unicorns`);438-expectType<ExecaSyncReturnValue>($({encoding: 'utf8'}).sync`unicorns`);649+expectType<ExecaReturnValue<false>>(await $({encoding: 'utf8'})`unicorns`);650+expectType<ExecaReturnValue<true>>($({encoding: 'utf8'}).sync`unicorns`);651 652 expectType<ExecaChildProcess>($({encoding: 'utf8'})`unicorns foo`);441-expectType<ExecaReturnValue>(await $({encoding: 'utf8'})`unicorns foo`);442-expectType<ExecaSyncReturnValue>($({encoding: 'utf8'}).sync`unicorns foo`);653+expectType<ExecaReturnValue<false>>(await $({encoding: 'utf8'})`unicorns foo`);654+expectType<ExecaReturnValue<true>>($({encoding: 'utf8'}).sync`unicorns foo`);655 656 expectType<ExecaChildProcess<Uint8Array>>($({encoding: 'buffer'})`unicorns`);445-expectType<ExecaReturnValue<Uint8Array>>(await $({encoding: 'buffer'})`unicorns`);446-expectType<ExecaSyncReturnValue<Uint8Array>>($({encoding: 'buffer'}).sync`unicorns`);657+expectType<ExecaReturnValue<false, Uint8Array>>(await $({encoding: 'buffer'})`unicorns`);658+expectType<ExecaReturnValue<true, Uint8Array>>($({encoding: 'buffer'}).sync`unicorns`);659 660 expectType<ExecaChildProcess<Uint8Array>>($({encoding: 'buffer'})`unicorns foo`);449-expectType<ExecaReturnValue<Uint8Array>>(await $({encoding: 'buffer'})`unicorns foo`);450-expectType<ExecaSyncReturnValue<Uint8Array>>($({encoding: 'buffer'}).sync`unicorns foo`);661+expectType<ExecaReturnValue<false, Uint8Array>>(await $({encoding: 'buffer'})`unicorns foo`);662+expectType<ExecaReturnValue<true, Uint8Array>>($({encoding: 'buffer'}).sync`unicorns foo`);663 664 expectType<ExecaChildProcess>($({encoding: 'buffer'})({encoding: 'utf8'})`unicorns`);453-expectType<ExecaReturnValue>(await $({encoding: 'buffer'})({encoding: 'utf8'})`unicorns`);454-expectType<ExecaSyncReturnValue>($({encoding: 'buffer'})({encoding: 'utf8'}).sync`unicorns`);665+expectType<ExecaReturnValue<false>>(await $({encoding: 'buffer'})({encoding: 'utf8'})`unicorns`);666+expectType<ExecaReturnValue<true>>($({encoding: 'buffer'})({encoding: 'utf8'}).sync`unicorns`);667 668 expectType<ExecaChildProcess>($({encoding: 'buffer'})({encoding: 'utf8'})`unicorns foo`);457-expectType<ExecaReturnValue>(await $({encoding: 'buffer'})({encoding: 'utf8'})`unicorns foo`);458-expectType<ExecaSyncReturnValue>($({encoding: 'buffer'})({encoding: 'utf8'}).sync`unicorns foo`);669+expectType<ExecaReturnValue<false>>(await $({encoding: 'buffer'})({encoding: 'utf8'})`unicorns foo`);670+expectType<ExecaReturnValue<true>>($({encoding: 'buffer'})({encoding: 'utf8'}).sync`unicorns foo`);671 672 expectType<ExecaChildProcess<Uint8Array>>($({encoding: 'buffer'})({})`unicorns`);461-expectType<ExecaReturnValue<Uint8Array>>(await $({encoding: 'buffer'})({})`unicorns`);462-expectType<ExecaSyncReturnValue<Uint8Array>>($({encoding: 'buffer'})({}).sync`unicorns`);673+expectType<ExecaReturnValue<false, Uint8Array>>(await $({encoding: 'buffer'})({})`unicorns`);674+expectType<ExecaReturnValue<true, Uint8Array>>($({encoding: 'buffer'})({}).sync`unicorns`);675 676 expectType<ExecaChildProcess<Uint8Array>>($({encoding: 'buffer'})({})`unicorns foo`);465-expectType<ExecaReturnValue<Uint8Array>>(await $({encoding: 'buffer'})({})`unicorns foo`);466-expectType<ExecaSyncReturnValue<Uint8Array>>($({encoding: 'buffer'})({}).sync`unicorns foo`);677+expectType<ExecaReturnValue<false, Uint8Array>>(await $({encoding: 'buffer'})({})`unicorns foo`);678+expectType<ExecaReturnValue<true, Uint8Array>>($({encoding: 'buffer'})({}).sync`unicorns foo`);679 468-expectType<ExecaReturnValue>(await $`unicorns ${'foo'}`);469-expectType<ExecaSyncReturnValue>($.sync`unicorns ${'foo'}`);470-expectType<ExecaReturnValue>(await $`unicorns ${1}`);471-expectType<ExecaSyncReturnValue>($.sync`unicorns ${1}`);472-expectType<ExecaReturnValue>(await $`unicorns ${['foo', 'bar']}`);473-expectType<ExecaSyncReturnValue>($.sync`unicorns ${['foo', 'bar']}`);474-expectType<ExecaReturnValue>(await $`unicorns ${[1, 2]}`);475-expectType<ExecaSyncReturnValue>($.sync`unicorns ${[1, 2]}`);476-expectType<ExecaReturnValue>(await $`unicorns ${await $`echo foo`}`);477-expectError<ExecaReturnValue>(await $`unicorns ${$`echo foo`}`);478-expectType<ExecaSyncReturnValue>($.sync`unicorns ${$.sync`echo foo`}`);479-expectType<ExecaReturnValue>(await $`unicorns ${[await $`echo foo`, 'bar']}`);480-expectError<ExecaReturnValue>(await $`unicorns ${[$`echo foo`, 'bar']}`);481-expectType<ExecaSyncReturnValue>($.sync`unicorns ${[$.sync`echo foo`, 'bar']}`);482-expectType<ExecaReturnValue>(await $`unicorns ${true.toString()}`);483-expectType<ExecaSyncReturnValue>($.sync`unicorns ${false.toString()}`);484-expectError<ExecaReturnValue>(await $`unicorns ${true}`);485-expectError<ExecaSyncReturnValue>($.sync`unicorns ${false}`);680+expectType<ExecaReturnValue<false>>(await $`unicorns ${'foo'}`);681+expectType<ExecaReturnValue<true>>($.sync`unicorns ${'foo'}`);682+expectType<ExecaReturnValue<false>>(await $`unicorns ${1}`);683+expectType<ExecaReturnValue<true>>($.sync`unicorns ${1}`);684+expectType<ExecaReturnValue<false>>(await $`unicorns ${['foo', 'bar']}`);685+expectType<ExecaReturnValue<true>>($.sync`unicorns ${['foo', 'bar']}`);686+expectType<ExecaReturnValue<false>>(await $`unicorns ${[1, 2]}`);687+expectType<ExecaReturnValue<true>>($.sync`unicorns ${[1, 2]}`);688+expectType<ExecaReturnValue<false>>(await $`unicorns ${await $`echo foo`}`);689+expectError<ExecaReturnValue<false>>(await $`unicorns ${$`echo foo`}`);690+expectType<ExecaReturnValue<true>>($.sync`unicorns ${$.sync`echo foo`}`);691+expectType<ExecaReturnValue<false>>(await $`unicorns ${[await $`echo foo`, 'bar']}`);692+expectError<ExecaReturnValue<false>>(await $`unicorns ${[$`echo foo`, 'bar']}`);693+expectType<ExecaReturnValue<true>>($.sync`unicorns ${[$.sync`echo foo`, 'bar']}`);694+expectType<ExecaReturnValue<false>>(await $`unicorns ${true.toString()}`);695+expectType<ExecaReturnValue<true>>($.sync`unicorns ${false.toString()}`);696+expectError<ExecaReturnValue<false>>(await $`unicorns ${true}`);697+expectError<ExecaReturnValue<true>>($.sync`unicorns ${false}`);