diff options
author | Asher Gomez <ashersaupingomez@gmail.com> | 2024-01-24 10:01:56 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-24 00:01:56 +0100 |
commit | 4eedac3604dad9f366d28868077eb02eddc22661 (patch) | |
tree | dda70cd31e731aad73e986002ef30acb84692dc4 /cli/tsc/dts/lib.deno.ns.d.ts | |
parent | 60688c563e6d02813b021ad91132fe1eb3f103b6 (diff) |
feat: `Deno.{stdin,stdout,stderr}.isTerminal()`, deprecate `Deno.isatty()` (#22011)
This change:
1. Implements `Deno.stdin.isTerminal()`, `Deno.stdout.isTerminal()` and
`Deno.stderr.isTerminal()`.
2. Deprecates `Deno.isatty()` for removal in Deno v2, in favour of the
above instance methods.
3. Replaces use of `Deno.isatty()` with the above instance methods.
Related #21995
---------
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
Diffstat (limited to 'cli/tsc/dts/lib.deno.ns.d.ts')
-rw-r--r-- | cli/tsc/dts/lib.deno.ns.d.ts | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/cli/tsc/dts/lib.deno.ns.d.ts b/cli/tsc/dts/lib.deno.ns.d.ts index 483c5c3d0..bc3248d02 100644 --- a/cli/tsc/dts/lib.deno.ns.d.ts +++ b/cli/tsc/dts/lib.deno.ns.d.ts @@ -2612,6 +2612,17 @@ declare namespace Deno { * @category I/O */ setRaw(mode: boolean, options?: SetRawOptions): void; + /** + * Checks if `stdin` is a TTY (terminal). + * + * ```ts + * // This example is system and context specific + * Deno.stdin.isTerminal(); // true + * ``` + * + * @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}, @@ -2629,6 +2640,17 @@ declare namespace Deno { readonly rid: number; /** A writable stream interface to `stdout`. */ readonly writable: WritableStream<Uint8Array>; + /** + * Checks if `stdout` is a TTY (terminal). + * + * ```ts + * // This example is system and context specific + * Deno.stdout.isTerminal(); // true + * ``` + * + * @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}, @@ -2646,6 +2668,17 @@ declare namespace Deno { readonly rid: number; /** A writable stream interface to `stderr`. */ readonly writable: WritableStream<Uint8Array>; + /** + * Checks if `stderr` is a TTY (terminal). + * + * ```ts + * // This example is system and context specific + * Deno.stderr.isTerminal(); // true + * ``` + * + * @category I/O + */ + isTerminal(): boolean; }; /** @@ -2728,6 +2761,10 @@ declare namespace Deno { * Deno.close(ttyRid); * ``` * + * @deprecated Use `Deno.stdin.isTerminal()`, `Deno.stdout.isTerminal()` or + * `Deno.stderr.isTerminal()` instead. + * {@linkcode Deno.isatty} will be removed in v2.0.0. + * * @category I/O */ export function isatty(rid: number): boolean; |