From 2bae96917963b26469854e2b918c79c3b89fb238 Mon Sep 17 00:00:00 2001 From: ehmicky Date: Tue, 2 Jul 2019 10:00:00 +0200 Subject: [PATCH] Add `result.all` TypeScript definition --- index.d.ts | 5 +++++ index.test-d.ts | 2 ++ readme.md | 2 ++ 3 files changed, 9 insertions(+) diff --git a/index.d.ts b/index.d.ts index f29c6d2601..e76cc89b1f 100644 --- a/index.d.ts +++ b/index.d.ts @@ -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 = ChildProcess & diff --git a/index.test-d.ts b/index.test-d.ts index 591ad5e5b9..0b3347c7c9 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -1,4 +1,5 @@ import {expectType, expectError} from 'tsd'; +import {Readable as ReadableStream} from 'stream' import execa = require('.'); import { ExecaReturnValue, @@ -11,6 +12,7 @@ import { try { const execaPromise = execa('unicorns'); execaPromise.cancel(); + expectType(execaPromise.all) const unicornsResult = await execaPromise; expectType(unicornsResult.command); diff --git a/readme.md b/readme.md index 8d111e8fc4..2838df6d20 100644 --- a/readme.md +++ b/readme.md @@ -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])