[babel 8] Use an identifier for TSTypeParameter.name#12829
[babel 8] Use an identifier for TSTypeParameter.name#12829nicolo-ribaudo merged 9 commits intobabel:mainfrom
TSTypeParameter.name#12829Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/47144/ |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit c689678:
|
packages/babel-parser/src/types.js
Outdated
| name: string, | ||
| typeName: Identifier, |
There was a problem hiding this comment.
We can also handle this as a union type assigning it under the BABEL_8_BREAKING flag.
(Typescript is using name and not typeName for TypeParameter)
| name: string, | |
| typeName: Identifier, | |
| name: string | Identifier, |
nicolo-ribaudo
left a comment
There was a problem hiding this comment.
Let's just do this for Babel 8 (BABEL_8_BREAKING).
This PR as-is is problematic because it introduces two different source of truth in the AST, and modifying typeName in a plugin doesn't have any effect on the generated code.
afadd08 to
a91f51e
Compare
a91f51e to
0325e76
Compare
|
Those ~30 errors are all related to |
d0d5af4 to
80ca25f
Compare
You need to duplicate them, rename the copy as |
|
It's huge |
typeName property to TSTypeParameterTSTypeReference.typeName
d99778f to
d5610d0
Compare
d5610d0 to
77951da
Compare
|
I re-approved because I'm not sure about what changed since my last review, but I reviewed it again. |
|
|
TSTypeReference.typeNameTSTypeParameter.name
We might still decide that it's better to align our Flow implementation with our TS implementation, rather than aligning it with the Flow AST. However, that's a separate discussion and let's keep this PR only for TS. |
BABEL_8_BREAKINGandBABEL_TYPES_8_BREAKINGWe parse the entire identifier if
BABEL_8_BREAKINGotherwise we parse just his name.