Skip to content

Commit

Permalink
Add missing result.all TypeScript definition (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky authored and sindresorhus committed Jul 4, 2019
1 parent b46cba1 commit aa070b8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,13 @@ declare namespace execa {
Similar to [`childProcess.kill()`](https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal). This is preferred when cancelling the child process execution as the error is more descriptive and [`childProcessResult.isCanceled`](#iscanceled) is set to `true`.
*/
cancel(): void;

/**
Stream combining/interleaving [`stdout`](https://nodejs.org/api/child_process.html#child_process_subprocess_stdout) and [`stderr`](https://nodejs.org/api/child_process.html#child_process_subprocess_stderr).
This is `undefined` when both `stdout` and `stderr` options are set to [`'pipe'`, `'ipc'`, `Stream` or `integer`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).
*/
all?: ReadableStream;
}

type ExecaChildProcess<StdoutErrorType = string> = ChildProcess &
Expand Down
2 changes: 2 additions & 0 deletions index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {expectType, expectError} from 'tsd';
import {Readable as ReadableStream} from 'stream'
import execa = require('.');
import {
ExecaReturnValue,
Expand All @@ -11,6 +12,7 @@ import {
try {
const execaPromise = execa('unicorns');
execaPromise.cancel();
expectType<ReadableStream | undefined>(execaPromise.all)

const unicornsResult = await execaPromise;
expectType<string>(unicornsResult.command);
Expand Down
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,12 @@ Similar to [`childProcess.kill()`](https://nodejs.org/api/child_process.html#chi

#### all

Type: `ReadableStream | undefined`

Stream combining/interleaving [`stdout`](https://nodejs.org/api/child_process.html#child_process_subprocess_stdout) and [`stderr`](https://nodejs.org/api/child_process.html#child_process_subprocess_stderr).

This is `undefined` when both [`stdout`](#stdout-1) and [`stderr`](#stderr-1) options are set to [`'pipe'`, `'ipc'`, `Stream` or `integer`](https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_options_stdio).

### execa.sync(file, [arguments], [options])

Execute a file synchronously.
Expand Down

0 comments on commit aa070b8

Please sign in to comment.