diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2021-04-20 10:12:33 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-20 10:12:33 +1000 |
commit | b6203cb4657f8269bf80b135b3c49fb9304895c1 (patch) | |
tree | 93d1eaf8057926c14ef097db861891ff6504ca7f /cli/dts | |
parent | 07887b120cb8bfeccb3a9dd2d65c4da9d84a3e60 (diff) |
revert: Conn type changes in #10012 and #10061 (#10255)
Fixes #10200 (again)
This reverts commit 9c7c9a35c12625bd4793c21539391d6b08d17e73 and a8057e3e06962a8d7c6330a085704bb4493eed04.
Diffstat (limited to 'cli/dts')
-rw-r--r-- | cli/dts/lib.deno.ns.d.ts | 36 | ||||
-rw-r--r-- | cli/dts/lib.deno.unstable.d.ts | 28 |
2 files changed, 26 insertions, 38 deletions
diff --git a/cli/dts/lib.deno.ns.d.ts b/cli/dts/lib.deno.ns.d.ts index 9c47cb879..738d0ba54 100644 --- a/cli/dts/lib.deno.ns.d.ts +++ b/cli/dts/lib.deno.ns.d.ts @@ -1726,44 +1726,40 @@ declare namespace Deno { * Requires `allow-write` permission. */ export function truncate(name: string, len?: number): Promise<void>; - export interface Addr { - transport: string; - } - - export interface NetAddr extends Addr { + export interface NetAddr { transport: "tcp" | "udp"; hostname: string; port: number; } - export interface UnixAddr extends Addr { + export interface UnixAddr { transport: "unix" | "unixpacket"; path: string; } + export type Addr = NetAddr | UnixAddr; + /** A generic network listener for stream-oriented protocols. */ - export interface Listener<Address extends Addr = Addr> - extends AsyncIterable<Conn<Address>> { + export interface Listener extends AsyncIterable<Conn> { /** Waits for and resolves to the next connection to the `Listener`. */ - accept(): Promise<Conn<Address>>; + accept(): Promise<Conn>; /** Close closes the listener. Any pending accept promises will be rejected * with errors. */ close(): void; /** Return the address of the `Listener`. */ - readonly addr: Address; + readonly addr: Addr; /** Return the rid of the `Listener`. */ readonly rid: number; - [Symbol.asyncIterator](): AsyncIterableIterator<Conn<Address>>; + [Symbol.asyncIterator](): AsyncIterableIterator<Conn>; } - export interface Conn<Address extends Addr = Addr> - extends Reader, Writer, Closer { + export interface Conn extends Reader, Writer, Closer { /** The local address of the connection. */ - readonly localAddr: Address; + readonly localAddr: Addr; /** The remote address of the connection. */ - readonly remoteAddr: Address; + readonly remoteAddr: Addr; /** The resource ID of the connection. */ readonly rid: number; /** Shuts down (`shutdown(2)`) the write side of the connection. Most @@ -1791,7 +1787,7 @@ declare namespace Deno { * Requires `allow-net` permission. */ export function listen( options: ListenOptions & { transport?: "tcp" }, - ): Listener<NetAddr>; + ): Listener; export interface ListenTlsOptions extends ListenOptions { /** Server certificate file. */ @@ -1810,7 +1806,7 @@ declare namespace Deno { * ``` * * Requires `allow-net` permission. */ - export function listenTls(options: ListenTlsOptions): Listener<NetAddr>; + export function listenTls(options: ListenTlsOptions): Listener; export interface ConnectOptions { /** The port to connect to. */ @@ -1833,7 +1829,7 @@ declare namespace Deno { * ``` * * Requires `allow-net` permission for "tcp". */ - export function connect(options: ConnectOptions): Promise<Conn<NetAddr>>; + export function connect(options: ConnectOptions): Promise<Conn>; export interface ConnectTlsOptions { /** The port to connect to. */ @@ -1859,9 +1855,7 @@ declare namespace Deno { * * Requires `allow-net` permission. */ - export function connectTls( - options: ConnectTlsOptions, - ): Promise<Conn<NetAddr>>; + export function connectTls(options: ConnectTlsOptions): Promise<Conn>; /** Shutdown socket send operations. * diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts index 96280af8f..8d4c1f87d 100644 --- a/cli/dts/lib.deno.unstable.d.ts +++ b/cli/dts/lib.deno.unstable.d.ts @@ -874,26 +874,23 @@ declare namespace Deno { /** **UNSTABLE**: new API, yet to be vetted. * * A generic transport listener for message-oriented protocols. */ - export interface DatagramConn<Address extends Addr = Addr> - extends AsyncIterable<[Uint8Array, Address]> { + export interface DatagramConn extends AsyncIterable<[Uint8Array, Addr]> { /** **UNSTABLE**: new API, yet to be vetted. * * Waits for and resolves to the next message to the `UDPConn`. */ - receive(p?: Uint8Array): Promise<[Uint8Array, Address]>; + receive(p?: Uint8Array): Promise<[Uint8Array, Addr]>; /** UNSTABLE: new API, yet to be vetted. * * Sends a message to the target. */ - send(p: Uint8Array, addr: Address): Promise<number>; + send(p: Uint8Array, addr: Addr): Promise<number>; /** UNSTABLE: new API, yet to be vetted. * * Close closes the socket. Any pending message promises will be rejected * with errors. */ close(): void; /** Return the address of the `UDPConn`. */ - readonly addr: Address; - [Symbol.asyncIterator](): AsyncIterableIterator< - [Uint8Array, Address] - >; + readonly addr: Addr; + [Symbol.asyncIterator](): AsyncIterableIterator<[Uint8Array, Addr]>; } export interface UnixListenOptions { @@ -912,7 +909,7 @@ declare namespace Deno { * Requires `allow-read` and `allow-write` permission. */ export function listen( options: UnixListenOptions & { transport: "unix" }, - ): Listener<UnixAddr>; + ): Listener; /** **UNSTABLE**: new API, yet to be vetted * @@ -933,7 +930,7 @@ declare namespace Deno { * Requires `allow-net` permission. */ export function listenDatagram( options: ListenOptions & { transport: "udp" }, - ): DatagramConn<NetAddr>; + ): DatagramConn; /** **UNSTABLE**: new API, yet to be vetted * @@ -949,7 +946,7 @@ declare namespace Deno { * Requires `allow-read` and `allow-write` permission. */ export function listenDatagram( options: UnixListenOptions & { transport: "unixpacket" }, - ): DatagramConn<UnixAddr>; + ): DatagramConn; export interface UnixConnectOptions { transport: "unix"; @@ -972,11 +969,8 @@ declare namespace Deno { * * Requires `allow-net` permission for "tcp" and `allow-read` for "unix". */ export function connect( - options: ConnectOptions, - ): Promise<Conn<NetAddr>>; - export function connect( - options: UnixConnectOptions, - ): Promise<Conn<UnixAddr>>; + options: ConnectOptions | UnixConnectOptions, + ): Promise<Conn>; export interface StartTlsOptions { /** A literal IP address or host name that can be resolved to an IP address. @@ -1005,7 +999,7 @@ declare namespace Deno { export function startTls( conn: Conn, options?: StartTlsOptions, - ): Promise<Conn<NetAddr>>; + ): Promise<Conn>; export interface ListenTlsOptions { /** **UNSTABLE**: new API, yet to be vetted. |