babel/babylon

[Presets: React + Typescript] Complex method with generic type fails during transpilation

babel-bot opened this issue · 2 comments

Original issue submitted by @pbadenski in babel/babel#6567

Bug.

Input Code

https://github.com/pbadenski/babel-typescript-sample

const liftA2 = <T, V> (x: X<T, V>): (f: Function) => null;

Babel Configuration

After checking out the code at the link above:
npm run transpile

Current Behavior

{ SyntaxError: src/a.ts: Unexpected token (1:17)
> 1 | const liftA2 = <T, V> (x: X<T, V>): (f: Function) => null;
    |                  ^
  2 | 
    at _class.raise (/Users/pbadenski/workspace/babel-typescript-sample/node_modules/babylon/lib/index.js:807:15)
    at _class.unexpected (/Users/pbadenski/workspace/babel-typescript-sample/node_modules/babylon/lib/index.js:2108:16)
    at _class.jsxParseIdentifier (/Users/pbadenski/workspace/babel-typescript-sample/node_modules/babylon/lib/index.js:8031:14)
    at _class.jsxParseNamespacedName (/Users/pbadenski/workspace/babel-typescript-sample/node_modules/babylon/lib/index.js:8042:23)
    at _class.jsxParseAttribute (/Users/pbadenski/workspace/babel-typescript-sample/node_modules/babylon/lib/index.js:8134:24)
    at _class.jsxParseOpeningElementAt (/Users/pbadenski/workspace/babel-typescript-sample/node_modules/babylon/lib/index.js:8146:35)
    at _class.jsxParseElementAt (/Users/pbadenski/workspace/babel-typescript-sample/node_modules/babylon/lib/index.js:8167:33)
    at _class.jsxParseElement (/Users/pbadenski/workspace/babel-typescript-sample/node_modules/babylon/lib/index.js:8228:19)
    at _class.parseExprAtom (/Users/pbadenski/workspace/babel-typescript-sample/node_modules/babylon/lib/index.js:8238:21)
    at _class.parseExprSubscripts (/Users/pbadenski/workspace/babel-typescript-sample/node_modules/babylon/lib/index.js:2864:21) pos: 17, loc: null }

Context

Using https://github.com/gcanti/fp-ts

Your Environment

software version(s)
Babel next (7.0.0-beta.3)
babel-preset-typescript next (7.0.0-beta.3)
babel-preset-react next (7.0.0-beta.3)
node v8.8.1
npm 5.5.1
Operating System Mac OS X 10.12.6
hzoo 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.

This issue has been moved to babel/babel#6665.