Skip to content

ReadableStream.from() method? #1691

Open
@karlhorky

Description

@karlhorky

Hi, first of all, thanks for your work on these type declarations, they are invaluable for working with web standards APIs.

It seems as if the following is not yet supported in TS 5.3.3 (also fails in Beta and Nightly):

ReadableStream.from(['a', 'b']);
//             ^^^^? Property 'from' does not exist on type '{
//                     new (body?: BodyInit | null | undefined, init?: ResponseInit | undefined): Response;
//                     prototype: Response;
//                     error(): Response;
//                     json(data: any, init?: ResponseInit | undefined): Response;
//                     redirect(url: string | URL, status?: number | undefined): Response;
//                   }'.

Maybe a similar PR is needed to update the types to the WebIDL Streams spec like @MattiasBuelens did in 2020 in #890?

Or is this not supported yet because only 3 runtimes (Firefox, Deno and Node.js) support this?

I can also re-submit this in https://github.com/microsoft/typescript if that makes more sense.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions