JamesHenry / typescript-estree

:sparkles: A parser that converts TypeScript source code into an ESTree-compatible form
https://jameshenry.blog
Other
84 stars 13 forks source link

BREAKING: correct nodes TSConstructorType and TSConstructorType #74

Closed armano2 closed 5 years ago

armano2 commented 5 years ago

This PR contains breaking changes and its alternative way of solving issue #30

Changes from this PR align structure of AST with what babel produces. There is alternative version of aligning those nodes #60


babel parses CallSignature and ConstructSignature as TSCallSignatureDeclaration and TSConstructSignatureDeclaration and has fields:

  interface foo {
    <P>(x: X): A
  }

right now we are parsing it as typeParameters, (params or parameters) and typeAnnotation

fixes: #30, #60

armano2 commented 5 years ago

i'm unsure how we should proceed with this, do we want to have same structure as babel for this? or we want to align it to how names are provided in estree...

JamesHenry commented 5 years ago

Yeah it's a tricky one for sure. The inconsistency on the babel side makes me think that maybe we should forgo compatibility on this one for now and just make a clear note that we need to fix it up on the babel side later.

There have been plenty of cases over the last year or so that I flagged up or fixed odd things on the babel side after discovering them through the ast-alignment testing, so it is not entirely unexpected.

What do you think?

armano2 commented 5 years ago

I'm OK with changing names of properties but I feel like we should keep type of node same as babel has

JamesHenry commented 5 years ago

Sounds good 👍

armano2 commented 5 years ago

ok i'm closing than #60 and i will rebase change here

JamesHenry commented 5 years ago

:tada: This PR is included in version 11.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: