Skip to content

Commit

Permalink
Add result.all TypeScript definition
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Jul 2, 2019
1 parent c9b4d09 commit 2bae969
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions index.d.ts
Expand Up @@ -321,6 +321,11 @@ 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).
*/
all?: ReadableStream;
}

type ExecaChildProcess<StdoutErrorType = string> = ChildProcess &
Expand Down
2 changes: 2 additions & 0 deletions index.test-d.ts
@@ -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
2 changes: 2 additions & 0 deletions readme.md
Expand Up @@ -164,6 +164,8 @@ 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).

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

0 comments on commit 2bae969

Please sign in to comment.