1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-28 16:20:57 -05:00

fix(types): fix streams types (#24770)

This commit is contained in:
Kenta Moriuchi 2024-07-29 12:21:00 +09:00 committed by GitHub
parent 41f8988dc7
commit ad5cec27d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 11 deletions

View file

@ -18823,7 +18823,7 @@ interface ReadableStream<R = any> {
declare var ReadableStream: { declare var ReadableStream: {
prototype: ReadableStream; prototype: ReadableStream;
new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number; size?: undefined }): ReadableStream<Uint8Array>; new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number }): ReadableStream<Uint8Array>;
new<R = any>(underlyingSource: UnderlyingDefaultSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>; new<R = any>(underlyingSource: UnderlyingDefaultSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>; new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
from<R>(asyncIterable: AsyncIterable<R> | Iterable<R | PromiseLike<R>>): ReadableStream<R>; from<R>(asyncIterable: AsyncIterable<R> | Iterable<R | PromiseLike<R>>): ReadableStream<R>;

View file

@ -4882,7 +4882,7 @@ interface ReadableStream<R = any> {
declare var ReadableStream: { declare var ReadableStream: {
prototype: ReadableStream; prototype: ReadableStream;
new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number; size?: undefined }): ReadableStream<Uint8Array>; new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number }): ReadableStream<Uint8Array>;
new<R = any>(underlyingSource: UnderlyingDefaultSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>; new<R = any>(underlyingSource: UnderlyingDefaultSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>; new<R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
from<R>(asyncIterable: AsyncIterable<R> | Iterable<R | PromiseLike<R>>): ReadableStream<R>; from<R>(asyncIterable: AsyncIterable<R> | Iterable<R | PromiseLike<R>>): ReadableStream<R>;

View file

@ -731,14 +731,6 @@ declare interface UnderlyingSourceCancelCallback {
(reason?: any): void | PromiseLike<void>; (reason?: any): void | PromiseLike<void>;
} }
// TODO(petamoriken): Will be removed in v2.0.
/**
* @deprecated use `UnderlyingSourcePullCallback` instead.
* @category Streams
*/
declare type ReadableStreamDefaultControllerCallback<R> =
UnderlyingSourcePullCallback<R>;
/** @category Streams */ /** @category Streams */
declare interface UnderlyingSourcePullCallback<R> { declare interface UnderlyingSourcePullCallback<R> {
(controller: ReadableStreamController<R>): void | PromiseLike<void>; (controller: ReadableStreamController<R>): void | PromiseLike<void>;
@ -749,6 +741,15 @@ declare interface UnderlyingSourceStartCallback<R> {
(controller: ReadableStreamController<R>): any; (controller: ReadableStreamController<R>): any;
} }
// TODO(petamoriken): Will be removed in v2.0.
/**
* @deprecated use `(controller: ReadableStreamDefaultController<R>) => void | PromiseLike<void>` type instead.
* @category Streams
*/
declare type ReadableStreamDefaultControllerCallback<R> = (
controller: ReadableStreamDefaultController<R>,
) => void | PromiseLike<void>;
/** @category Streams */ /** @category Streams */
declare interface ReadableStreamDefaultController<R = any> { declare interface ReadableStreamDefaultController<R = any> {
readonly desiredSize: number | null; readonly desiredSize: number | null;
@ -877,7 +878,7 @@ declare var ReadableStream: {
readonly prototype: ReadableStream; readonly prototype: ReadableStream;
new ( new (
underlyingSource: UnderlyingByteSource, underlyingSource: UnderlyingByteSource,
strategy?: { highWaterMark?: number; size?: undefined }, strategy?: { highWaterMark?: number },
): ReadableStream<Uint8Array>; ): ReadableStream<Uint8Array>;
new <R = any>( new <R = any>(
underlyingSource: UnderlyingDefaultSource<R>, underlyingSource: UnderlyingDefaultSource<R>,