New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Special case ReadableStream type to mean Node.js ReadableStream #99
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for finding this and proposing a fix!
I like your second offer better, dropping this PR and fixing the docs directly, since changing a few lines of docs is better long-term than adding more special cases to your typescript definitions.
Closing this PR because of that rationale, but I'd be happy to approve & merge a PR on the docs themselves. Thank you!
Reopening after talking it over with @MarshallOfSound 😃 -- let's do it this way |
This adds support for qualified namespaced types in parameters. I.e. you can now write `NodeJS.ReadableStream`. See electron/typescript-definitions#99 and
Cool. Turns out that there was a bit more to it than "changing a few lines of docs" 😛. First I found that I had to modify the parser in Let me know which ones (if any) of these branches you'd want me to upstream. I'd imagine you'd want the docs changes (minus the qualified type on |
Yup 😀That would be awesome 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks, @niik 👍
Opened electron/electron#12899 and #101 |
Hey friends, I forgot about this PR until I tried to use the API again and hit the same type error. @ckerr Is there anything more you need from me on this or are we good to merge? |
I prepended semantic-pull-requests is installed on this repo, but this PR predates it so the status check is not showing up. To whomever merges this PR, please squash. 🎃 |
The StreamProtocolResponse.data property is supposed to be a Node.js readable stream.
Unfortunately the
ReadableStream
type is ambiguous between the Node.jsReadableStream
and theReadableStream
interface defined in the web Streams standard and since the web stream standard is part of the standard lib in TS it'll choose that.This PR special cases the
ReadableStream
type name to qualify it with the Node.js namespace.I wasn't sure what the best approach here would be, special case it in the definition generator or update the documentation to be explicit about the type.
I'm happy to drop this and PR a change to the docs if you'd like.
Diff of generated definitions before/after this change
cc @zeke