Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
refactor(typescript-estree): add type guards for typescript-estree#3078
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Thanks for the PR,@armano2! 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 onhttps://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitorsper day. |
codecovbot commentedFeb 20, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report
@@ Coverage Diff @@## master #3078 +/- ##======================================= Coverage 92.83% 92.83% ======================================= Files 314 314 Lines 10672 10675 +3 Branches 3027 3027 =======================================+ Hits 9907 9910 +3 Misses 348 348 Partials 417 417
Flags with carried forward coverage won't be shown.Click here to find out more.
|
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Conflicts:packages/types/src/ts-estree.tspackages/typescript-estree/src/convert.ts
| allowPattern?:boolean, | ||
| ):any{ | ||
| allowPattern?:P, | ||
| ):TSESTreeToTSNodeGuard<typeofnode,P>{ |
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.
I don't think this works the way you think it will - typescript will not parameterise the passed type ofnode, meaning this type will be the same asTSESTreeToTSNodeGuard<TSNodeConvertable, P>
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.
yea i know that this type is not going to work, and it seem that there is no easy way around it, for now i just wanted to validate if we are missing anything in ast, best aproach i can think of is
privateconvertJSXTagName<Textendsts.JsxTagNameExpression>(node:T,parent:ts.Node,):Textendsts.JsxTagNamePropertyAccess ?TSESTree.JSXMemberExpression :Textendsts.ThisExpression|ts.Identifier ?TSESTree.JSXIdentifier :TSESTree.JSXMemberExpression|TSESTree.JSXIdentifier;privateconvertJSXTagName(node:ts.JsxTagNameExpression,parent:ts.Node,):TSESTree.JSXMemberExpression|TSESTree.JSXIdentifier{
different function but same issue
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.
Uh oh!
There was an error while loading.Please reload this page.
This PR aims to add proper types to conversion done by typescript-estree
this PR is currently blocked by#2933,#3081
changes from#3081 has been merged to this branch
detected issues with AST so far
LeftHandSideExpressioncan be aAwaitExpression#3083IntrinsicKeywordis not defined in AST#3081PrivateIdentifieris not defined in AST#2933TryStatementfinalizer can benull#3083RegExpLiteralvalue can benullif regexp is invalid or unsupported by env#3083good example in this case can be any proposal that has not been accepted yet
eg.https://github.com/tc39/proposal-regexp-match-indices
JSXOpeningElementattributes can be aJSXSpreadAttribute#3083TSModuleDeclarationbody can beTSModuleDeclaration#3083issues that need additional investigation