Unexpected token ":"

15 views
Skip to first unread message

João Fernandes

unread,
May 27, 2015, 11:25:52 AM5/27/15
to traceur-comp...@googlegroups.com
Hi, I'm trying in arrow function to define a datatype like this

someArray.forEach(item:SomeDataType => .....) but traceur always throws an error Unexpected token ":".

As soon I comment the dataType, it works perfectly.

I'm using 0.0.79 with this arguments:


experimental: true,
modules: 'amd',
blockBinding:true,
types:true,
annotations:true,
memberVariables:true,
asyncFunctions:true

Erik Arvidsson

unread,
May 27, 2015, 12:23:55 PM5/27/15
to traceur-comp...@googlegroups.com
Type annotations are not supported in arrow functions.

I just tried it in TypeScript, and your code does not work there
either. In TS you need to use parens if you want type annotaions in
the arrow formals.

It is also not clear how this can be speced? Lets bring it up on the
TS github repo.
> --
> You received this message because you are subscribed to the Google Groups
> "traceur-compiler-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to traceur-compiler-d...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
erik
Reply all
Reply to author
Forward
0 new messages