diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2020-06-27 12:44:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-27 13:44:02 +0200 |
commit | d77a55a97371f75eeabe39f4f051013029926839 (patch) | |
tree | 045d155e20e0033801e06e86f4ac4c8e587ae1df /cli/js | |
parent | affba804546607c0d26887bb5c40cba9c9be3fe6 (diff) |
fix(cli/js/process): Fix conditional types for process sockets (#6275)
Diffstat (limited to 'cli/js')
-rw-r--r-- | cli/js/lib.deno.ns.d.ts | 12 | ||||
-rw-r--r-- | cli/js/process.ts | 12 |
2 files changed, 18 insertions, 6 deletions
diff --git a/cli/js/lib.deno.ns.d.ts b/cli/js/lib.deno.ns.d.ts index f9438ed9c..f3ee04243 100644 --- a/cli/js/lib.deno.ns.d.ts +++ b/cli/js/lib.deno.ns.d.ts @@ -1779,9 +1779,15 @@ declare namespace Deno { export class Process<T extends RunOptions = RunOptions> { readonly rid: number; readonly pid: number; - readonly stdin: T["stdin"] extends "piped" ? Writer & Closer : null; - readonly stdout: T["stdout"] extends "piped" ? Reader & Closer : null; - readonly stderr: T["stderr"] extends "piped" ? Reader & Closer : null; + readonly stdin: T["stdin"] extends "piped" + ? Writer & Closer + : (Writer & Closer) | null; + readonly stdout: T["stdout"] extends "piped" + ? Reader & Closer + : (Writer & Closer) | null; + readonly stderr: T["stderr"] extends "piped" + ? Reader & Closer + : (Writer & Closer) | null; /** Resolves to the current status of the process. */ status(): Promise<ProcessStatus>; /** Buffer the stdout until EOF and return it as `Uint8Array`. diff --git a/cli/js/process.ts b/cli/js/process.ts index f318b0c1c..c7c3358f5 100644 --- a/cli/js/process.ts +++ b/cli/js/process.ts @@ -32,9 +32,15 @@ async function runStatus(rid: number): Promise<ProcessStatus> { export class Process<T extends RunOptions = RunOptions> { readonly rid: number; readonly pid: number; - readonly stdin!: T["stdin"] extends "piped" ? Writer & Closer : null; - readonly stdout!: T["stdout"] extends "piped" ? Reader & Closer : null; - readonly stderr!: T["stderr"] extends "piped" ? Reader & Closer : null; + readonly stdin!: T["stdin"] extends "piped" + ? Writer & Closer + : (Writer & Closer) | null; + readonly stdout!: T["stdout"] extends "piped" + ? Reader & Closer + : (Writer & Closer) | null; + readonly stderr!: T["stderr"] extends "piped" + ? Reader & Closer + : (Writer & Closer) | null; // @internal constructor(res: RunResponse) { |