dk00 / livescript-next

Enable latest ES features for LiveScript
https://lsn.netlify.com/
The Unlicense
39 stars 3 forks source link

livescript + flow = awesome! #7

Open AriaMinaei opened 7 years ago

AriaMinaei commented 7 years ago

First off, thanks for the great work @dk00! I've been following this project from the beginning, and I couldn't be more excited about it and more grateful.

Now, I don't know if you've considered the possibility of adding type annotation syntax in the future, but just wanted to let you know that there is some new discussion about this in the flow issue tracker, and I thought you might want to weigh in.

dk00 commented 7 years ago

babel-types refuses to create AST nodes with type annotations, but the code generator knows annotations and output them correctly.

We can build AST with type annotations, by adding them to AST nodes generated by babel-types:

declaration = t.function-declaration id, params, body, false false
declaration.return-type = t.type-annotation t.void-type-annotation!

Type annotation syntax can be implemented in this way, if it is added to livescript (gkz/LiveScript#803 ?).