Skip to content
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

fix(ts-estree): align typeArguments and typeParameters across nodes #223

Merged
merged 1 commit into from
Feb 7, 2019
Merged

fix(ts-estree): align typeArguments and typeParameters across nodes #223

merged 1 commit into from
Feb 7, 2019

Conversation

armano2
Copy link
Member

@armano2 armano2 commented Feb 6, 2019

This PR aligns typeParameters and typeArguments across all nodes

fixes: #220

@armano2 armano2 self-assigned this Feb 6, 2019
@codecov
Copy link

codecov bot commented Feb 6, 2019

Codecov Report

Merging #223 into master will increase coverage by 0.08%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #223      +/-   ##
==========================================
+ Coverage   96.57%   96.65%   +0.08%     
==========================================
  Files          51       51              
  Lines        2455     2455              
  Branches      370      370              
==========================================
+ Hits         2371     2373       +2     
+ Misses         42       41       -1     
+ Partials       42       41       -1
Impacted Files Coverage Δ
packages/typescript-estree/src/convert.ts 97.57% <100%> (+0.3%) ⬆️

@bradzacher
Copy link
Member

bradzacher commented Feb 6, 2019

I was wondering after looking at #222 - why do we have so many optional properties on the AST?
Wouldn't it be better for us to use empty arrays instead of just not setting a prop at all?

I can understand an optional field in the case of interface -> implements where it's not "supposed" to be there.
But like in the case of type parameters/arguments/annotations; wouldn't it be better for us to just set an empty array to save the plugin (and consumers) from doing undefined checks?

@armano2
Copy link
Member Author

armano2 commented Feb 6, 2019

those nodes does no contain undefined arrays
TSTypeParameterDeclaration and TSTypeParameterInstantiation used for typeArguments and typeParameters contain in range <> tokens and they have array of params

TSTypeAnnotation contains in range : or =>

this is useful for setting up comments in AST, and without that there is no easy way to determine if comment is /* test */< /* test */ string /* test */> /* test */ before/after or within <>

Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JamesHenry JamesHenry merged commit 3306198 into typescript-eslint:master Feb 7, 2019
@armano2 armano2 deleted the type-arguments-parameters branch February 7, 2019 01:26
kaicataldo pushed a commit to kaicataldo/typescript-eslint that referenced this pull request Aug 27, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incosistent AST for typeArgument and typeParameters
3 participants