1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

fix(network): adjust Listener type params (#18642)

Fixes https://github.com/denoland/deno/issues/18635
This commit is contained in:
Jonathan Rezende 2023-08-27 17:55:04 -03:00 committed by Bartek Iwańczuk
parent 4a0d27d085
commit 8b34936788
No known key found for this signature in database
GPG key ID: 0C6BCDDC3B3AD750

View file

@ -24,9 +24,9 @@ declare namespace Deno {
*
* @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`. */
accept(): Promise<Conn>;
accept(): Promise<T>;
/** Close closes the listener. Any pending accept promises will be rejected
* with errors. */
close(): void;
@ -36,7 +36,7 @@ declare namespace Deno {
/** Return the rid of the `Listener`. */
readonly rid: number;
[Symbol.asyncIterator](): AsyncIterableIterator<Conn>;
[Symbol.asyncIterator](): AsyncIterableIterator<T>;
/**
* Make the listener block the event loop from finishing.
@ -54,11 +54,7 @@ declare namespace Deno {
*
* @category Network
*/
export interface TlsListener extends Listener, AsyncIterable<TlsConn> {
/** Waits for a TLS client to connect and accepts the connection. */
accept(): Promise<TlsConn>;
[Symbol.asyncIterator](): AsyncIterableIterator<TlsConn>;
}
export type TlsListener = Listener<TlsConn>;
/** @category Network */
export interface Conn extends Reader, Writer, Closer {