mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
fix(cli/js/net): Make generator return types iterable (#4661)
This commit is contained in:
parent
263dc8f5fe
commit
95eb6d780c
2 changed files with 6 additions and 6 deletions
4
cli/js/lib.deno.ns.d.ts
vendored
4
cli/js/lib.deno.ns.d.ts
vendored
|
@ -1877,7 +1877,7 @@ declare namespace Deno {
|
||||||
close(): void;
|
close(): void;
|
||||||
/** Return the address of the `UDPConn`. */
|
/** Return the address of the `UDPConn`. */
|
||||||
readonly addr: Addr;
|
readonly addr: Addr;
|
||||||
[Symbol.asyncIterator](): AsyncIterator<[Uint8Array, Addr]>;
|
[Symbol.asyncIterator](): AsyncIterableIterator<[Uint8Array, Addr]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A generic network listener for stream-oriented protocols. */
|
/** A generic network listener for stream-oriented protocols. */
|
||||||
|
@ -1890,7 +1890,7 @@ declare namespace Deno {
|
||||||
/** Return the address of the `Listener`. */
|
/** Return the address of the `Listener`. */
|
||||||
readonly addr: Addr;
|
readonly addr: Addr;
|
||||||
|
|
||||||
[Symbol.asyncIterator](): AsyncIterator<Conn>;
|
[Symbol.asyncIterator](): AsyncIterableIterator<Conn>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Conn extends Reader, Writer, Closer {
|
export interface Conn extends Reader, Writer, Closer {
|
||||||
|
|
|
@ -16,7 +16,7 @@ export interface DatagramConn extends AsyncIterable<[Uint8Array, Addr]> {
|
||||||
|
|
||||||
addr: Addr;
|
addr: Addr;
|
||||||
|
|
||||||
[Symbol.asyncIterator](): AsyncIterator<[Uint8Array, Addr]>;
|
[Symbol.asyncIterator](): AsyncIterableIterator<[Uint8Array, Addr]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Listener extends AsyncIterable<Conn> {
|
export interface Listener extends AsyncIterable<Conn> {
|
||||||
|
@ -26,7 +26,7 @@ export interface Listener extends AsyncIterable<Conn> {
|
||||||
|
|
||||||
addr: Addr;
|
addr: Addr;
|
||||||
|
|
||||||
[Symbol.asyncIterator](): AsyncIterator<Conn>;
|
[Symbol.asyncIterator](): AsyncIterableIterator<Conn>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ConnImpl implements Conn {
|
export class ConnImpl implements Conn {
|
||||||
|
@ -69,7 +69,7 @@ export class ListenerImpl implements Listener {
|
||||||
close(this.rid);
|
close(this.rid);
|
||||||
}
|
}
|
||||||
|
|
||||||
async *[Symbol.asyncIterator](): AsyncIterator<Conn> {
|
async *[Symbol.asyncIterator](): AsyncIterableIterator<Conn> {
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
yield await this.accept();
|
yield await this.accept();
|
||||||
|
@ -112,7 +112,7 @@ export class DatagramImpl implements DatagramConn {
|
||||||
close(this.rid);
|
close(this.rid);
|
||||||
}
|
}
|
||||||
|
|
||||||
async *[Symbol.asyncIterator](): AsyncIterator<[Uint8Array, Addr]> {
|
async *[Symbol.asyncIterator](): AsyncIterableIterator<[Uint8Array, Addr]> {
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
yield await this.receive();
|
yield await this.receive();
|
||||||
|
|
Loading…
Add table
Reference in a new issue