TypeScript Version: 2.4.1
It would be nice for this part of the spec to be supported: https://streams.spec.whatwg.org/#rs-constructor
Code
const stream = new ReadableStream({
start(controller) {
controller.close();
}
});
Expected behavior: Code should compile
Actual behavior: Supplied parameters do not match any signature of call target. error. I assume this is because the built-in types aren't expecting any arguments passed into the constructor.
PRs welcomed. You can find more information about contributing lib.d.ts fixes at https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md#contributing-libdts-fixes.
@mhegazy I made an implementation of the streams standard in TS and have a full d.ts file with all of the types, view it in my repo
Before I spend many hours trying to wrangle this into the added/deleted/modified JSONs, you may notice I made the types parameterised by their in/out data types. My Qs:
Thanks
For those still interested, I'm setting up a PR now to add/fix all streams-related types in the TSJS generator. But the tool is a bit quirky and has very obscure error messages so it's going a bit slow. I also decided against making the types generic to keep it simple.
The above mentioned pull request by @MattiasBuelens will fix this and all other missing parts of the streams types, and they're generic too!
https://github.com/Microsoft/TSJS-lib-generator/pull/541 has been merged and this issue can now be closed. @sandersn Not sure who to ping here from the TS team, but since you merged the PR you know the context. Thanks.
error TS2554: Expected 0 arguments, but got 1.
14 body: new ReadableStream({
~~~~~~~~~~~~~~~~~~~~
15 pull(c) {
~~~~~~~~~~~~~~~~~
...
18 }
~~~~~~~~~
19 })
@EtherDream The improved types for streams were added in TypeScript 3.2. Can you verify that you're using an up-to-date version of TypeScript in your project? If that doesn't solve it, I recommend opening a separate issue for your problem.
@mhegazy or @RyanCavanaugh: This issue can be closed, as it has been fixed in TypeScript 3.2.
@MattiasBuelens thanks!
Most helpful comment
PRs welcomed. You can find more information about contributing lib.d.ts fixes at https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md#contributing-libdts-fixes.