diff options
author | Luca Casonato <hello@lcas.dev> | 2023-11-01 20:26:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-01 20:26:12 +0100 |
commit | d42f1543121e7245789a96a485d1ef7645cb5fba (patch) | |
tree | d57a10ac527fe5b6796a3a8866af95f0f1a5d7bd /cli/tsc/dts/lib.deno.ns.d.ts | |
parent | 1d19b1011bd7df50598f5981408c2d78c35b76d2 (diff) |
feat: disposable Deno resources (#20845)
This commit implements Symbol.dispose and Symbol.asyncDispose for
the relevant resources.
Closes #20839
---------
Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
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 | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/cli/tsc/dts/lib.deno.ns.d.ts b/cli/tsc/dts/lib.deno.ns.d.ts index e51e9736a..08c8e9e9d 100644 --- a/cli/tsc/dts/lib.deno.ns.d.ts +++ b/cli/tsc/dts/lib.deno.ns.d.ts @@ -2,6 +2,7 @@ /// <reference no-default-lib="true" /> /// <reference lib="esnext" /> +/// <reference lib="esnext.disposable" /> /// <reference lib="deno.net" /> /** Deno provides extra properties on `import.meta`. These are included here @@ -2177,7 +2178,8 @@ declare namespace Deno { WriterSync, Seeker, SeekerSync, - Closer { + Closer, + Disposable { /** The resource ID associated with the file instance. The resource ID * should be considered an opaque reference to resource. */ readonly rid: number; @@ -2451,6 +2453,8 @@ declare namespace Deno { * ``` */ close(): void; + + [Symbol.dispose](): void; } /** @@ -3831,7 +3835,7 @@ declare namespace Deno { * * @category File System */ - export interface FsWatcher extends AsyncIterable<FsEvent> { + export interface FsWatcher extends AsyncIterable<FsEvent>, Disposable { /** The resource id. */ readonly rid: number; /** Stops watching the file system and closes the watcher resource. */ @@ -4284,7 +4288,7 @@ declare namespace Deno { * * @category Sub Process */ - export class ChildProcess { + export class ChildProcess implements Disposable { get stdin(): WritableStream<Uint8Array>; get stdout(): ReadableStream<Uint8Array>; get stderr(): ReadableStream<Uint8Array>; @@ -4307,6 +4311,8 @@ declare namespace Deno { /** Ensure that the status of the child process does not block the Deno * process from exiting. */ unref(): void; + + [Symbol.dispose](): void; } /** @@ -5258,7 +5264,7 @@ declare namespace Deno { * requests on the HTTP server connection. * * @category HTTP Server */ - export interface HttpConn extends AsyncIterable<RequestEvent> { + export interface HttpConn extends AsyncIterable<RequestEvent>, Disposable { /** The resource ID associated with this connection. Generally users do not * need to be aware of this identifier. */ readonly rid: number; @@ -5911,7 +5917,7 @@ declare namespace Deno { * * @category HTTP Server */ - export interface HttpServer { + export interface HttpServer extends AsyncDisposable { /** A promise that resolves once server finishes - eg. when aborted using * the signal passed to {@linkcode ServeOptions.signal}. */ |