1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-03 12:58:54 -05:00

fix(cli/js/process): Fix conditional types for process sockets (#6275)

This commit is contained in:
Nayeem Rahman 2020-06-27 12:44:02 +01:00 committed by GitHub
parent affba80454
commit d77a55a973
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 6 deletions

View file

@ -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`.

View file

@ -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) {