diff --git a/cli/js/lib.deno.ns.d.ts b/cli/js/lib.deno.ns.d.ts index be4b1f15dd..63e9b342ed 100644 --- a/cli/js/lib.deno.ns.d.ts +++ b/cli/js/lib.deno.ns.d.ts @@ -1545,6 +1545,9 @@ declare namespace Deno { /** Return the address of the `Listener`. */ readonly addr: Addr; + /** Return the rid of the `Listener`. */ + readonly rid: number; + [Symbol.asyncIterator](): AsyncIterableIterator; } diff --git a/cli/js/net.ts b/cli/js/net.ts index 0c40cceae3..2de44c2acc 100644 --- a/cli/js/net.ts +++ b/cli/js/net.ts @@ -26,6 +26,8 @@ export interface Listener extends AsyncIterable { addr: Addr; + rid: number; + [Symbol.asyncIterator](): AsyncIterableIterator; } diff --git a/cli/tests/unit/net_test.ts b/cli/tests/unit/net_test.ts index 9e9a1e5e8f..4fd253a6c9 100644 --- a/cli/tests/unit/net_test.ts +++ b/cli/tests/unit/net_test.ts @@ -4,6 +4,7 @@ import { assert, assertEquals, createResolvable, + assertNotEquals, } from "./test_util.ts"; unitTest({ perms: { net: true } }, function netTcpListenClose(): void { @@ -11,6 +12,7 @@ unitTest({ perms: { net: true } }, function netTcpListenClose(): void { assert(listener.addr.transport === "tcp"); assertEquals(listener.addr.hostname, "127.0.0.1"); assertEquals(listener.addr.port, 3500); + assertNotEquals(listener.rid, 0); listener.close(); });