-
Notifications
You must be signed in to change notification settings - Fork 68
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
Migrate JSBI source to TypeScript. #67
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.
Source changes look good, with a few minor comments.
What's with the (internal) functions that haven't received type annotations?
Hopefully Mathias can say more about the open questions.
Regarding target ES level: keep in mind that JSBI is squarely targeted at old browsers. We've had people specifically request IE11 compatibility fixes before. I'm not sure how they dealt with the fact that class JSBI
is an ES2015 feature. So it might even make sense to target ES5. (For the majority of the code, it shouldn't make a difference anyway.)
The problem with es5 transpilation is that the tsc output for |
"What's with the (internal) functions that haven't received type annotations?" I had another branch with these and forgot to merge it in before pushing/reviewing. PTAL. I tried to infer the right types for things based on how they were used, but there's at least a couple places where the tsc control flow can't infer the right things, so some casts were necessary to retain the existing code. |
@justingrant You did a great job finding and helping me figure out the source-mapping issues with the Temporal TS migration - would you mind taking a look at JSBI as well? |
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.
Code changes LGTM. I'll leave the packaging questions to other reviewers.
See inline comment. Can we avoid making this change?
Hmm, I’m not sure… Could you test with DevTools?
No. The way I think about this is: the fact we’re using TS is an implementation detail, and does not influence the library that we end up publishing. We could include
The current approach seems fine to me. |
@@ -817,7 +817,7 @@ const dataSmall = [{ | |||
r: '0x7bffcbe01' | |||
}]; | |||
|
|||
import JSBI from '../jsbi.mjs'; |
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.
It's annoying that TypeScript doesn't support this (I guess?), because it breaks d8 benchmarks/sub.mjs
— we now have to always test the compiled output instead.
Released as v3.2.0. |
This is based off similar work I did for js-temporal/temporal-polyfill#21.
Open questions: