Closed pnevyk closed 4 years ago
Any reason this has not been merged?
Active development has moved to the babel/babel
monorepo. We are working to get the new packages out the door, and appreciate your patience!
Thank you for the PR. Now that @babel/eslint-parser
has been released, we are making this repository read-only. If this is a change you would still like to advocate for, please reopen this in the babel/babel monorepo.
This PR deals with #625. It fixes three things (implementations are split into separate commits for convenient review):
declare type = ...
anddeclare interface Foo {}
which were missingOne thing I am not sure about is this part. The root cause of function generics misbehavior was that
_visitTypeAnnotation
was treating type parameters of function type annotation as variable references instead of variable declarations. But I am not sure if this is the best fix, especially whether_nestTypeParamScope
is used correctly.I must have change some tests which were imho incorrect (1, 2).
I would like to tackle the other half of #625 issue as well, either in this PR or in a separate one. But I want to be sure that my reasoning is correct:
In my opinion,
declare ...
statements should not emitno-unused-vars
regardless if they are referenced in the file or not, since they serve as library definitions (ie. typed interface with outside world for code without Flow types in sources). Therefore I propose to reference these declarations automatically.Also, I think that this known issue can be removed from the README, as it is not issue anymore for some time already.