babel / babylon

PSA: moved into babel/babel as @babel/parser -->

Home Page:https://github.com/babel/babel/tree/master/packages/babel-parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeScript `TypeParameterDeclaration` start data different to precedent in Flow

JamesHenry opened this issue · comments

@andy-ms We opted for using TypeParameterDeclaration fo follow Flow's precedent, and the full structure matches up apart from the location start data.

I found this when running AST comparison tests between typescript-eslint-parser and babylon with the typescript plugin enabled.

Here is a failing test case: master...JamesHenry:ts-type-dec-whitespace (I am not able to create branches directly on the babylon repo)

And here is the same source being processed by babylon with the flow plugin, instead of the typescript one to confirm the desired loc start: http://astexplorer.net/#/gist/9f3be6b712aab2a99a0b15d7bad2bdef/0a2dbc87712a2d55f3a72dbfdbac6f80da39e376

Expected Behavior

Expect the linked expected.json to be produced when the linked source code is parsed

Current Behavior

The start column and range[0] of the TypeParameterDeclaration node is 13 (the start of the first TypeParameter node within the params array) instead of 10 as it should be.

commented

Hey @JamesHenry! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

I did take a brief look at the code for TypeParameterDeclaration but I am not yet up to speed on it and did not have time to figure out a solution yet