diff options
author | Asher Gomez <ashersaupingomez@gmail.com> | 2024-01-25 01:59:55 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-24 15:59:55 +0100 |
commit | 62786cfebb5c9fe36d0930582951f442bdfe9441 (patch) | |
tree | a1bede5492a5b1bf4a202ee8994df027f098e788 /cli/tsc/dts/lib.deno.ns.d.ts | |
parent | 4af121687cb4c26f4a2f3e4ad266490d8faa3d2d (diff) |
feat: deprecate `Deno.close()` (#22066)
For removal in Deno v2.
---------
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli/tsc/dts/lib.deno.ns.d.ts')
-rw-r--r-- | cli/tsc/dts/lib.deno.ns.d.ts | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/cli/tsc/dts/lib.deno.ns.d.ts b/cli/tsc/dts/lib.deno.ns.d.ts index 351610fd2..b255ea6e7 100644 --- a/cli/tsc/dts/lib.deno.ns.d.ts +++ b/cli/tsc/dts/lib.deno.ns.d.ts @@ -1977,11 +1977,10 @@ declare namespace Deno { * * ```ts * // if "/foo/bar.txt" contains the text "hello world": - * const file = await Deno.open("/foo/bar.txt"); + * using file = await Deno.open("/foo/bar.txt"); * const buf = new Uint8Array(100); * const numberOfBytesRead = await Deno.read(file.rid, buf); // 11 bytes * const text = new TextDecoder().decode(buf); // "hello world" - * Deno.close(file.rid); * ``` * * @deprecated Use `reader.read()` instead. {@linkcode Deno.read} will be @@ -2010,11 +2009,10 @@ declare namespace Deno { * * ```ts * // if "/foo/bar.txt" contains the text "hello world": - * const file = Deno.openSync("/foo/bar.txt"); + * using file = Deno.openSync("/foo/bar.txt"); * const buf = new Uint8Array(100); * const numberOfBytesRead = Deno.readSync(file.rid, buf); // 11 bytes * const text = new TextDecoder().decode(buf); // "hello world" - * Deno.close(file.rid); * ``` * * @deprecated Use `reader.readSync()` instead. {@linkcode Deno.readSync} @@ -2037,9 +2035,8 @@ declare namespace Deno { * ```ts * const encoder = new TextEncoder(); * const data = encoder.encode("Hello world"); - * const file = await Deno.open("/foo/bar.txt", { write: true }); + * using file = await Deno.open("/foo/bar.txt", { write: true }); * const bytesWritten = await Deno.write(file.rid, data); // 11 - * Deno.close(file.rid); * ``` * * @category I/O @@ -2060,9 +2057,8 @@ declare namespace Deno { * ```ts * const encoder = new TextEncoder(); * const data = encoder.encode("Hello world"); - * const file = Deno.openSync("/foo/bar.txt", { write: true }); + * using file = Deno.openSync("/foo/bar.txt", { write: true }); * const bytesWritten = Deno.writeSync(file.rid, data); // 11 - * Deno.close(file.rid); * ``` * * @category I/O @@ -2268,6 +2264,9 @@ declare namespace Deno { * // do work with "file" object * ``` * + * @deprecated Use `.close()` method on the resource instead. + * {@linkcode Deno.close} will be removed in Deno 2.0. + * * @category I/O */ export function close(rid: number): void; @@ -2860,8 +2859,6 @@ declare namespace Deno { * const ttyRid = Deno.openSync("/dev/tty6").rid; * console.log(Deno.isatty(nonTTYRid)); // false * console.log(Deno.isatty(ttyRid)); // true - * Deno.close(nonTTYRid); - * Deno.close(ttyRid); * ``` * * @deprecated Use `Deno.stdin.isTerminal()`, `Deno.stdout.isTerminal()` or |