mirror of
https://github.com/denoland/deno.git
synced 2024-12-01 16:51:13 -05:00
fix(network): adjust Listener type params (#18642)
Fixes https://github.com/denoland/deno/issues/18635
This commit is contained in:
parent
4a0d27d085
commit
8b34936788
1 changed files with 4 additions and 8 deletions
12
ext/net/lib.deno_net.d.ts
vendored
12
ext/net/lib.deno_net.d.ts
vendored
|
@ -24,9 +24,9 @@ declare namespace Deno {
|
||||||
*
|
*
|
||||||
* @category Network
|
* @category Network
|
||||||
*/
|
*/
|
||||||
export interface Listener extends AsyncIterable<Conn> {
|
export interface Listener<T extends Conn = Conn> extends AsyncIterable<T> {
|
||||||
/** Waits for and resolves to the next connection to the `Listener`. */
|
/** Waits for and resolves to the next connection to the `Listener`. */
|
||||||
accept(): Promise<Conn>;
|
accept(): Promise<T>;
|
||||||
/** Close closes the listener. Any pending accept promises will be rejected
|
/** Close closes the listener. Any pending accept promises will be rejected
|
||||||
* with errors. */
|
* with errors. */
|
||||||
close(): void;
|
close(): void;
|
||||||
|
@ -36,7 +36,7 @@ declare namespace Deno {
|
||||||
/** Return the rid of the `Listener`. */
|
/** Return the rid of the `Listener`. */
|
||||||
readonly rid: number;
|
readonly rid: number;
|
||||||
|
|
||||||
[Symbol.asyncIterator](): AsyncIterableIterator<Conn>;
|
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make the listener block the event loop from finishing.
|
* Make the listener block the event loop from finishing.
|
||||||
|
@ -54,11 +54,7 @@ declare namespace Deno {
|
||||||
*
|
*
|
||||||
* @category Network
|
* @category Network
|
||||||
*/
|
*/
|
||||||
export interface TlsListener extends Listener, AsyncIterable<TlsConn> {
|
export type TlsListener = Listener<TlsConn>;
|
||||||
/** Waits for a TLS client to connect and accepts the connection. */
|
|
||||||
accept(): Promise<TlsConn>;
|
|
||||||
[Symbol.asyncIterator](): AsyncIterableIterator<TlsConn>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @category Network */
|
/** @category Network */
|
||||||
export interface Conn extends Reader, Writer, Closer {
|
export interface Conn extends Reader, Writer, Closer {
|
||||||
|
|
Loading…
Reference in a new issue