web-streams-polyfill 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -146,7 +146,7 @@ export declare class ReadableStream<R = any> {
146
146
  * The supplied `reason` argument will be given to the underlying source's {@link UnderlyingSource.cancel | cancel()}
147
147
  * method, which might or might not use it.
148
148
  */
149
- cancel(reason?: any): Promise<undefined>;
149
+ cancel(reason?: any): Promise<void>;
150
150
  /**
151
151
  * Creates a {@link ReadableStreamBYOBReader} and locks the stream to the new reader.
152
152
  *
@@ -175,7 +175,10 @@ export declare class ReadableStream<R = any> {
175
175
  *
176
176
  * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
177
177
  */
178
- pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
178
+ pipeThrough<RS extends ReadableStream>(transform: {
179
+ readable: RS;
180
+ writable: WritableStream<R>;
181
+ }, options?: StreamPipeOptions): RS;
179
182
  /**
180
183
  * Pipes this readable stream to a given writable stream. The way in which the piping process behaves under
181
184
  * various error conditions can be customized with a number of passed options. It returns a promise that fulfills
@@ -183,7 +186,7 @@ export declare class ReadableStream<R = any> {
183
186
  *
184
187
  * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
185
188
  */
186
- pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<undefined>;
189
+ pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
187
190
  /**
188
191
  * Tees this readable stream, returning a two-element array containing the two resulting branches as
189
192
  * new {@link ReadableStream} instances.
@@ -220,7 +223,7 @@ export declare class ReadableStream<R = any> {
220
223
  * @public
221
224
  */
222
225
  export declare interface ReadableStreamAsyncIterator<R> extends AsyncIterator<R> {
223
- next(): Promise<IteratorResult<R>>;
226
+ next(): Promise<IteratorResult<R, undefined>>;
224
227
  return(value?: any): Promise<IteratorResult<any>>;
225
228
  }
226
229
 
@@ -239,7 +242,7 @@ export declare class ReadableStreamBYOBReader {
239
242
  /**
240
243
  * If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.
241
244
  */
242
- cancel(reason?: any): Promise<undefined>;
245
+ cancel(reason?: any): Promise<void>;
243
246
  /**
244
247
  * Attempts to reads bytes into view, and returns a promise resolved with the result.
245
248
  *
@@ -342,7 +345,7 @@ export declare class ReadableStreamDefaultReader<R = any> {
342
345
  /**
343
346
  * If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.
344
347
  */
345
- cancel(reason?: any): Promise<undefined>;
348
+ cancel(reason?: any): Promise<void>;
346
349
  /**
347
350
  * Returns a promise that allows access to the next chunk from the stream's internal queue, if available.
348
351
  *
@@ -371,7 +374,7 @@ export declare type ReadableStreamDefaultReadResult<T> = {
371
374
  value: T;
372
375
  } | {
373
376
  done: true;
374
- value: undefined;
377
+ value?: undefined;
375
378
  };
376
379
 
377
380
  /**
@@ -654,7 +657,7 @@ export declare class WritableStream<W = any> {
654
657
  * that there was an error doing so. Additionally, it will reject with a `TypeError` (without attempting to cancel
655
658
  * the stream) if the stream is currently locked.
656
659
  */
657
- abort(reason?: any): Promise<undefined>;
660
+ abort(reason?: any): Promise<void>;
658
661
  /**
659
662
  * Closes the stream. The underlying sink will finish processing any previously-written chunks, before invoking its
660
663
  * close behavior. During this time any further attempts to write will fail (without erroring the stream).
@@ -733,11 +736,11 @@ export declare class WritableStreamDefaultWriter<W = any> {
733
736
  /**
734
737
  * If the reader is active, behaves the same as {@link WritableStream.abort | stream.abort(reason)}.
735
738
  */
736
- abort(reason?: any): Promise<undefined>;
739
+ abort(reason?: any): Promise<void>;
737
740
  /**
738
741
  * If the reader is active, behaves the same as {@link WritableStream.close | stream.close()}.
739
742
  */
740
- close(): Promise<undefined>;
743
+ close(): Promise<void>;
741
744
  /**
742
745
  * Releases the writer’s lock on the corresponding stream. After the lock is released, the writer is no longer active.
743
746
  * If the associated stream is errored when the lock is released, the writer will appear errored in the same way from
@@ -758,7 +761,7 @@ export declare class WritableStreamDefaultWriter<W = any> {
758
761
  * Note that what "success" means is up to the underlying sink; it might indicate simply that the chunk has been
759
762
  * accepted, and not necessarily that it is safely saved to its ultimate destination.
760
763
  */
761
- write(chunk: W): Promise<undefined>;
764
+ write(chunk: W): Promise<void>;
762
765
  }
763
766
 
764
767
  export { }
@@ -146,7 +146,7 @@ export declare class ReadableStream<R = any> {
146
146
  * The supplied `reason` argument will be given to the underlying source's {@link UnderlyingSource.cancel | cancel()}
147
147
  * method, which might or might not use it.
148
148
  */
149
- cancel(reason?: any): Promise<undefined>;
149
+ cancel(reason?: any): Promise<void>;
150
150
  /**
151
151
  * Creates a {@link ReadableStreamBYOBReader} and locks the stream to the new reader.
152
152
  *
@@ -175,7 +175,10 @@ export declare class ReadableStream<R = any> {
175
175
  *
176
176
  * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
177
177
  */
178
- pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
178
+ pipeThrough<RS extends ReadableStream>(transform: {
179
+ readable: RS;
180
+ writable: WritableStream<R>;
181
+ }, options?: StreamPipeOptions): RS;
179
182
  /**
180
183
  * Pipes this readable stream to a given writable stream. The way in which the piping process behaves under
181
184
  * various error conditions can be customized with a number of passed options. It returns a promise that fulfills
@@ -183,7 +186,7 @@ export declare class ReadableStream<R = any> {
183
186
  *
184
187
  * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
185
188
  */
186
- pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<undefined>;
189
+ pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
187
190
  /**
188
191
  * Tees this readable stream, returning a two-element array containing the two resulting branches as
189
192
  * new {@link ReadableStream} instances.
@@ -220,7 +223,7 @@ export declare class ReadableStream<R = any> {
220
223
  * @public
221
224
  */
222
225
  export declare interface ReadableStreamAsyncIterator<R> extends AsyncIterator<R> {
223
- next(): Promise<IteratorResult<R>>;
226
+ next(): Promise<IteratorResult<R, undefined>>;
224
227
  return(value?: any): Promise<IteratorResult<any>>;
225
228
  }
226
229
 
@@ -239,7 +242,7 @@ export declare class ReadableStreamBYOBReader {
239
242
  /**
240
243
  * If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.
241
244
  */
242
- cancel(reason?: any): Promise<undefined>;
245
+ cancel(reason?: any): Promise<void>;
243
246
  /**
244
247
  * Attempts to reads bytes into view, and returns a promise resolved with the result.
245
248
  *
@@ -342,7 +345,7 @@ export declare class ReadableStreamDefaultReader<R = any> {
342
345
  /**
343
346
  * If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.
344
347
  */
345
- cancel(reason?: any): Promise<undefined>;
348
+ cancel(reason?: any): Promise<void>;
346
349
  /**
347
350
  * Returns a promise that allows access to the next chunk from the stream's internal queue, if available.
348
351
  *
@@ -371,7 +374,7 @@ export declare type ReadableStreamDefaultReadResult<T> = {
371
374
  value: T;
372
375
  } | {
373
376
  done: true;
374
- value: undefined;
377
+ value?: undefined;
375
378
  };
376
379
 
377
380
  /**
@@ -654,7 +657,7 @@ export declare class WritableStream<W = any> {
654
657
  * that there was an error doing so. Additionally, it will reject with a `TypeError` (without attempting to cancel
655
658
  * the stream) if the stream is currently locked.
656
659
  */
657
- abort(reason?: any): Promise<undefined>;
660
+ abort(reason?: any): Promise<void>;
658
661
  /**
659
662
  * Closes the stream. The underlying sink will finish processing any previously-written chunks, before invoking its
660
663
  * close behavior. During this time any further attempts to write will fail (without erroring the stream).
@@ -733,11 +736,11 @@ export declare class WritableStreamDefaultWriter<W = any> {
733
736
  /**
734
737
  * If the reader is active, behaves the same as {@link WritableStream.abort | stream.abort(reason)}.
735
738
  */
736
- abort(reason?: any): Promise<undefined>;
739
+ abort(reason?: any): Promise<void>;
737
740
  /**
738
741
  * If the reader is active, behaves the same as {@link WritableStream.close | stream.close()}.
739
742
  */
740
- close(): Promise<undefined>;
743
+ close(): Promise<void>;
741
744
  /**
742
745
  * Releases the writer’s lock on the corresponding stream. After the lock is released, the writer is no longer active.
743
746
  * If the associated stream is errored when the lock is released, the writer will appear errored in the same way from
@@ -758,7 +761,7 @@ export declare class WritableStreamDefaultWriter<W = any> {
758
761
  * Note that what "success" means is up to the underlying sink; it might indicate simply that the chunk has been
759
762
  * accepted, and not necessarily that it is safely saved to its ultimate destination.
760
763
  */
761
- write(chunk: W): Promise<undefined>;
764
+ write(chunk: W): Promise<void>;
762
765
  }
763
766
 
764
767
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-streams-polyfill",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "Web Streams, based on the WHATWG spec reference implementation",
5
5
  "main": "dist/polyfill",
6
6
  "browser": "dist/polyfill.min.js",