Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Deno.{Stdin,Stdout,Stderr} interfaces #22168

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
69 changes: 40 additions & 29 deletions cli/tsc/dts/lib.deno.ns.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2742,24 +2742,8 @@ declare namespace Deno {
cbreak: boolean;
}

/** A reference to `stdin` which can be used to read directly from `stdin`.
* It implements the Deno specific {@linkcode Reader}, {@linkcode ReaderSync},
* and {@linkcode Closer} interfaces as well as provides a
* {@linkcode ReadableStream} interface.
*
* ### Reading chunks from the readable stream
*
* ```ts
* const decoder = new TextDecoder();
* for await (const chunk of Deno.stdin.readable) {
* const text = decoder.decode(chunk);
* // do something with the text
* }
* ```
*
* @category I/O
*/
export const stdin: Reader & ReaderSync & Closer & {
/** @category I/O */
export interface Stdin extends Reader, ReaderSync, Closer {
/**
* The resource ID assigned to `stdin`. This can be used with the discreet
* I/O functions in the `Deno` namespace.
Expand Down Expand Up @@ -2796,18 +2780,29 @@ declare namespace Deno {
* @category I/O
*/
isTerminal(): boolean;
};
/** A reference to `stdout` which can be used to write directly to `stdout`.
* It implements the Deno specific {@linkcode Writer}, {@linkcode WriterSync},
}

/** A reference to `stdin` which can be used to read directly from `stdin`.
* It implements the Deno specific {@linkcode Reader}, {@linkcode ReaderSync},
* and {@linkcode Closer} interfaces as well as provides a
* {@linkcode WritableStream} interface.
* {@linkcode ReadableStream} interface.
*
* These are low level constructs, and the {@linkcode console} interface is a
* more straight forward way to interact with `stdout` and `stderr`.
* ### Reading chunks from the readable stream
*
* ```ts
* const decoder = new TextDecoder();
* for await (const chunk of Deno.stdin.readable) {
* const text = decoder.decode(chunk);
* // do something with the text
* }
* ```
*
* @category I/O
*/
export const stdout: Writer & WriterSync & Closer & {
export const stdin: Stdin;

/** @category I/O */
export interface Stdout extends Writer, WriterSync, Closer {
/**
* The resource ID assigned to `stdout`. This can be used with the discreet
* I/O functions in the `Deno` namespace.
Expand All @@ -2830,8 +2825,9 @@ declare namespace Deno {
* @category I/O
*/
isTerminal(): boolean;
};
/** A reference to `stderr` which can be used to write directly to `stderr`.
}

/** A reference to `stdout` which can be used to write directly to `stdout`.
* It implements the Deno specific {@linkcode Writer}, {@linkcode WriterSync},
* and {@linkcode Closer} interfaces as well as provides a
* {@linkcode WritableStream} interface.
Expand All @@ -2841,7 +2837,10 @@ declare namespace Deno {
*
* @category I/O
*/
export const stderr: Writer & WriterSync & Closer & {
export const stdout: Stdout;

/** @category I/O */
export interface Stderr extends Writer, WriterSync, Closer {
/**
* The resource ID assigned to `stderr`. This can be used with the discreet
* I/O functions in the `Deno` namespace.
Expand All @@ -2864,7 +2863,19 @@ declare namespace Deno {
* @category I/O
*/
isTerminal(): boolean;
};
}

/** A reference to `stderr` which can be used to write directly to `stderr`.
* It implements the Deno specific {@linkcode Writer}, {@linkcode WriterSync},
* and {@linkcode Closer} interfaces as well as provides a
* {@linkcode WritableStream} interface.
*
* These are low level constructs, and the {@linkcode console} interface is a
* more straight forward way to interact with `stdout` and `stderr`.
*
* @category I/O
*/
export const stderr: Stderr;

/**
* Options which can be set when doing {@linkcode Deno.open} and
Expand Down