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(typescript-estree): add strict type mapping to parserServices.esTreeNodeToTSNodeMap
#1382
feat(typescript-estree): add strict type mapping to parserServices.esTreeNodeToTSNodeMap
#1382
Conversation
This comment has been minimized.
This comment has been minimized.
there are a lot of places that I just dropped in Instead of using an excludes, I think it would be a good idea to strictly type the Also for For the getter on WDYT? |
@bradzacher type mapping is added, i'm unsure if we should expose it to plugins |
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 was actually thinking we should do something like this, but I was too lazy to go through the parser logic and pull out the mapping. So thanks!
I think this is a good idea, and I like the idea of removing the manual conversion as I wouldn't be surprised if we got it wrong around the place.
Could you also run the no-unnecessary-type-arguments
rule to fix up any manual annotations that are now unnecessary?
packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts
Outdated
Show resolved
Hide resolved
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 - one question then I'm happy for this to merge.
parserServices.esTreeNodeToTSNodeMap
There wasn't a bug before, just relaxed types; so switching this to a feat, it's an enhancement and strictification of the types we already provided. |
I'm unsure if we actually want this change and if place where type is defined is good one.
i was also thinking about name:
ParserServicesConvertibleTypes
rules that will have to be updated to use more strict types instead of Node:
@bradzacher what do you think about this?
for example in
prefer-regexp-exec
functionisStringType
is used to check type but as argument it acceptsTSESTree.Node
and it shouldTSESTree.LeftHandSideExpression