Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse error with type annotation in fat-arrow #37

Closed
fdecampredon opened this issue Nov 19, 2014 · 7 comments
Closed

Parse error with type annotation in fat-arrow #37

fdecampredon opened this issue Nov 19, 2014 · 7 comments
Assignees
Labels
incompleteness Something is missing

Comments

@fdecampredon
Copy link

The parser does not parse type annotation on argument in fat-arrow:

/*@flow*/
var f = (t: string) => t;
***/sampleArrow.js:2:11,11: Unexpected token :

It also does not parse return value type annotation:

/*@flow*/
var f = (t): string => t;
***/sampleArrow.js:2:12,12: Unexpected token :
@sophiebits
Copy link
Contributor

For what it's worth, this works:

var f: (t: string) => string = (t) => t;

@gabelevi gabelevi self-assigned this Nov 19, 2014
@avikchaudhuri avikchaudhuri added the incompleteness Something is missing label Nov 19, 2014
@salper
Copy link

salper commented Dec 5, 2014

👍

@ryanisinallofus
Copy link

+1

@gabelevi
Copy link
Contributor

I actually just refactored the parser this weekend to make it really easy to add features to arrow functions, like type annotations, type parameters, async, generators, etc. It slows down the parsing at the moment by like 14%, which isn't great, but parsing isn't the majority of our time at the moment so I'm not sure if we mind too much.

@samwgoldman
Copy link
Member

This just landed in master (yay!) and will hopefully be fixed in the next release.

@gabelevi
Copy link
Contributor

Also it shouldn't cause a perf regression, thanks to some great advice from @bhosmer :)

@mroch
Copy link
Contributor

mroch commented Jun 17, 2015

0.12 is out, should be fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incompleteness Something is missing
Projects
None yet
Development

No branches or pull requests

8 participants