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
feat(parser/ts): support optional variance annotations #4008
feat(parser/ts): support optional variance annotations #4008
Conversation
Is it included in rc? I didn't check the typescript blog recently... |
No, I just made it "ready for review". do not merge until microsoft/TypeScript#48240 is merged. |
I see, thanks! |
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.
LGTM. Thank you!
Not marking as approval as to prevent mistake
I'm testing the type variance annotations with JSX(tsx). const validJSX = <in T>() => {}</in>;
const validTypeVarianceFN = <in T,>() => {};
const expectedError = <in T>() => {}; The first two are parsed expected.
When I investigated, I found that this was a pre-existing issue. const expectedError = <T>() => {}; |
I didn't know that |
Babel will revert this feature and defer it to Babel 8. |
Note that it should be an error only in TSX files, not in TS files. Due to how Babel needs to be configured, many people enabled TSX mode also for |
@magic-akari I found that typescript PR is merged, and you added some tests. |
Yes. It's ready for review. |
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!
swc-bump:
- swc_atoms
- swc_ecma_ast --breaking
Description:
Implement: Optional variance annotations
BREAKING CHANGE:
Related issue (if exists):