diff options
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 |