diff --git a/index.d.ts b/index.d.ts index de8c253e..29ef3435 100644 --- a/index.d.ts +++ b/index.d.ts @@ -788,6 +788,7 @@ declare class ReadableStream { pipeThrough(transform: ReadableStreamTransform, options?: PipeToOptions): ReadableStream; pipeTo(destination: WritableStream, options?: PipeToOptions): Promise; tee(): [ReadableStream, ReadableStream]; + values(options?: ReadableStreamValuesOptions): ReadableStreamReadableStreamAsyncIterator; } declare class ReadableStreamBYOBReader { @@ -833,6 +834,12 @@ declare type ReadableStreamPipeToOptions = PipeToOptions; declare type ReadableStreamReadResult = { done: true; value: undefined; } | { done: false; value: T; }; +declare class ReadableStreamReadableStreamAsyncIterator { + constructor(underlyingSource?: Object, queuingStrategy?: Object); + next(): Promise>; + return(reason?: any): Promise>; +} + /** * Back-compat alias. * @deprecated Use ReadableStreamBYOBReader @@ -850,6 +857,10 @@ interface ReadableStreamTransform { readable: ReadableStream; } +interface ReadableStreamValuesOptions { + preventCancel?: boolean; +} + declare class Request extends Body { constructor(input: Request | string, init?: RequestInit | Request); clone(): Request; diff --git a/src/workers.json b/src/workers.json index 056c377f..99c2ec51 100644 --- a/src/workers.json +++ b/src/workers.json @@ -6930,6 +6930,23 @@ ] } } + }, + { + "name": "values", + "type": { + "params": [ + { + "name": "options", + "type": { + "name": "ReadableStreamValuesOptions", + "optional": true + } + } + ], + "returns": { + "name": "ReadableStreamReadableStreamAsyncIterator" + } + } } ], "kind": "class" @@ -7346,6 +7363,79 @@ ], "kind": "typedef" }, + "ReadableStreamReadableStreamAsyncIterator": { + "name": "ReadableStreamReadableStreamAsyncIterator", + "members": [ + { + "name": "constructor", + "type": { + "params": [ + { + "name": "underlyingSource", + "type": { + "name": "Object", + "optional": true + } + }, + { + "name": "queuingStrategy", + "type": { + "name": "Object", + "optional": true + } + } + ] + } + }, + { + "name": "next", + "type": { + "params": [], + "returns": { + "name": "Promise", + "args": [ + { + "name": "ReadableStreamReadResult", + "args": [ + { + "name": "any" + } + ] + } + ] + } + } + }, + { + "name": "return", + "type": { + "params": [ + { + "name": "reason", + "type": { + "name": "any", + "optional": true + } + } + ], + "returns": { + "name": "Promise", + "args": [ + { + "name": "ReadableStreamReadResult", + "args": [ + { + "name": "any" + } + ] + } + ] + } + } + } + ], + "kind": "class" + }, "ReadableStreamReadableStreamBYOBReader": { "name": "ReadableStreamReadableStreamBYOBReader", "type": { @@ -7386,6 +7476,19 @@ ], "kind": "struct" }, + "ReadableStreamValuesOptions": { + "name": "ReadableStreamValuesOptions", + "members": [ + { + "name": "preventCancel", + "type": { + "name": "boolean", + "optional": true + } + } + ], + "kind": "struct" + }, "Request": { "name": "Request", "members": [