TypeScript-DOM-lib-generator
TypeScript-DOM-lib-generator copied to clipboard
ReadableStream.from() method?
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;
// }'.
- Playground: https://www.typescriptlang.org/play?ts=5.3.3#code/PTAEAsBdIBwZwFwgCYFMBuqA2B7GqAnAOgFscAvASyywEMicCBzYVAOwFoBVAZWGRwBjOMADqqAEbAAggAUAksABKqWsloSsqHpAKqSwAGYEcJAPpxItSJUEAoEBGjwkwS3tok4ROPkFEAd3BrAKYGZmAAYgI4DhgTSBxIAE98OxVfHDY4VCJjUwAKAG0AcloSgBpQEokSgF0ASgBuOyA
- WhatWG Streams Spec https://streams.spec.whatwg.org/#rs-prototype
- MDN ReadableStream: from() static method (experimental) https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/from_static
Maybe a similar PR is needed to update the types to the WebIDL Streams spec like @MattiasBuelens did in 2020 in https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/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.