-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Add TypeScript type declaration file #255
Comments
I'm very comfortable with our TS support because we use the JSDoc style. What I'm uncomfortable with is writing pure TypeScript code and transpiling it. So, I'd be totally fine with as index.d.ts file so long as code in the project remains ES. |
Waiting for microsoft/TypeScript#7546... |
microsoft/TypeScript#7546 has been resolved and is supported as of TypeScript 3.7. |
Hey @ExE-Boss, you have been quite active for editing @types/webidl2. Are you interested in generating them right from the sources? I haven't been too active in this area so your help would be very precious. |
Well, I tried it already, but I ran into microsoft/TypeScript#4433. |
Oh, TIL! Generating separate module definitions doesn't sound like a blocker for me though. My immediate blocker is that I have no way to generate .d.ts without also generating .js files. (Well I can just remove them after build but there should be an option not to generate them 🤔) |
|
Thanks, and this is now interesting.
Maybe worth filing a bug... (Edit: microsoft/TypeScript#40385) |
If you wanna workaround the issue for now (I have a PR out with a fix) - the interface merge(s) in |
Thanks @weswigham! Should I remove the supplement for now and instead define them in JSDoc? What would be the alternatives? Will the merging still be supported? |
Yeah, it'll work once the patch I have out is in. |
Earlier, I made a comment about our use of TS in this project. Over the last week, I've finally had a chance to really deep dive into TS. I now have a much better understanding of what it does and what it's actually for. Going forwards, I just wanted to go on the record that I'd feel quite comfortable with us adopting TS fully if we ever want to refactor this project (though I'd probably stay away from a few of the experimental things and just stick to the static analysis feature set of TS). |
We still need more |
Somehow still doesn't work as expected, filed microsoft/TypeScript#47358 |
@saschanaz Did you get the reply on that bug report for the workaround? Is it possible to use here? |
I think that works but the result should be refined to match the current DT types. Probably we can copypaste some of it. |
Adding
index.d.ts
in the root directory will enable other packages to automatically read it to properly typecheck any use of webidl2.js.Previously I had to contribute to DefinitelyTyped like DefinitelyTyped/DefinitelyTyped#25092 but it's harder to maintain as it has a separate versioning system.
@marcoscaceres What do you think, as you previously stated a concern about adding TS support? #55 (comment)
The text was updated successfully, but these errors were encountered: