From 0237165eb143dbddfcc45a403df34cf8cc010a33 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Fri, 29 Mar 2019 16:14:19 +0700 Subject: [PATCH] Make ChildProcessWithoutNullStreams a ChildProcess --- types/node/child_process.d.ts | 2 +- types/node/test/child_process.ts | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/types/node/child_process.d.ts b/types/node/child_process.d.ts index 6531e30d75..803772ccca 100644 --- a/types/node/child_process.d.ts +++ b/types/node/child_process.d.ts @@ -79,7 +79,7 @@ declare module "child_process" { } // return this object when stdio option is undefined or not specified - interface ChildProcessWithoutNullStreams { + interface ChildProcessWithoutNullStreams extends ChildProcess { stdin: Writable; stdout: Readable; stderr: Readable; diff --git a/types/node/test/child_process.ts b/types/node/test/child_process.ts index e0289ba183..9b1ab01f6c 100644 --- a/types/node/test/child_process.ts +++ b/types/node/test/child_process.ts @@ -302,6 +302,25 @@ async function testPromisify() { expectNonNull(childProcess.spawn('command', ['a', 'b', 'c'], { stdio: [undefined, undefined, undefined] })); expectNonNull(childProcess.spawn('command', ['a', 'b', 'c'], { stdio: [null, null, null] })); expectNonNull(childProcess.spawn('command', ['a', 'b', 'c'], { stdio: ['pipe', 'pipe', 'pipe'] })); + + function expectChildProcess (cp: childProcess.ChildProcess): void { + return undefined; + } + + expectChildProcess(childProcess.spawn('command')); + expectChildProcess(childProcess.spawn('command', {})); + expectChildProcess(childProcess.spawn('command', { stdio: undefined })); + expectChildProcess(childProcess.spawn('command', { stdio: 'pipe' })); + expectChildProcess(childProcess.spawn('command', { stdio: [undefined, undefined, undefined] })); + expectChildProcess(childProcess.spawn('command', { stdio: [null, null, null] })); + expectChildProcess(childProcess.spawn('command', { stdio: ['pipe', 'pipe', 'pipe'] })); + expectChildProcess(childProcess.spawn('command', ['a', 'b', 'c'])); + expectChildProcess(childProcess.spawn('command', ['a', 'b', 'c'], {})); + expectChildProcess(childProcess.spawn('command', ['a', 'b', 'c'], { stdio: undefined })); + expectChildProcess(childProcess.spawn('command', ['a', 'b', 'c'], { stdio: 'pipe' })); + expectChildProcess(childProcess.spawn('command', ['a', 'b', 'c'], { stdio: [undefined, undefined, undefined] })); + expectChildProcess(childProcess.spawn('command', ['a', 'b', 'c'], { stdio: [null, null, null] })); + expectChildProcess(childProcess.spawn('command', ['a', 'b', 'c'], { stdio: ['pipe', 'pipe', 'pipe'] })); } { process.stdin.setEncoding('utf8');