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

stage-0 and stage-1 don't play well with typescript around exporting types

babel-bot opened this issue · comments

Original issue submitted by @pelotom in babel/babel#6066

With this .babelrc:

{
  "presets": ["stage-1", "typescript"]
}

attempting to compile

export type Foo = number

gives an error:

SyntaxError: src/index.ts: Unexpected token (1:12)
> 1 | export type Foo = number
    |             ^
  2 |

Same for stage-0. stage-2 and stage-3 are not affected.

commented

Hey @babel-bot! 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.

commented

Hm that's weird @andy-ms - the ordering shouldn't matter for the presets but I guess its an issue with another syntax plugin in https://github.com/babel/babel/blob/7.0/packages/babel-preset-stage-1/src/index.js? That seems odd

It could be that with the new export proposals, export type is interpreted as the first part of export type from "module".
I am from the mobile right now, so I can't check this assumption.

commented

Fixed by #663

Fixed by 663

#664?

commented

Yeah, that happens a lot..