-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: [4.7] support optional variance annotation #4831
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: [4.7] support optional variance annotation #4831
Conversation
Thanks for the PR, @sosukesuzuki! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day. |
👷 Deploy request for typescript-eslint pending review.Visit the deploys page to approve it
|
cff13e4
to
c88f8ef
Compare
i merged the version bump so this can be rebased on top of main |
c88f8ef
to
435f610
Compare
Codecov Report
@@ Coverage Diff @@
## main #4831 +/- ##
==========================================
+ Coverage 91.32% 91.70% +0.38%
==========================================
Files 132 359 +227
Lines 1487 12117 +10630
Branches 224 3518 +3294
==========================================
+ Hits 1358 11112 +9754
- Misses 65 657 +592
- Partials 64 348 +284
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -2342,6 +2362,7 @@ export class Converter { | |||
? this.convertType(node.constraint) | |||
: undefined, | |||
default: node.default ? this.convertType(node.default) : undefined, | |||
...this.convertTypeParamVariances(node.modifiers), |
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.
what do you think about changing it to hasModifier
to be consistent with other use cases?
...this.convertTypeParamVariances(node.modifiers), | |
in: hasModifier(SyntaxKind.InKeyword, node) || undefined, | |
out: hasModifier(SyntaxKind.OutKeyword, node) || undefined, |
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.
instead of undefined
- could we make it false
?
I'd love for us to standardise on not emitting undefined
for properties.
I personally don't like having 3 states on a flag - the keyword is either there, or it's not - there's no 3rd state!
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.
this LGTM now! Thanks so much for helping us prep for 4.7!
there's a few snapshots which need regenerating in |
Thank you for reviewing! I've updated tests! |
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.
brilliant - thanks for all your hard work!
PR Checklist
Overview
Based on #4829
Support optional variance syntax.