futurescript icon indicating copy to clipboard operation
futurescript copied to clipboard

Flow and optional type support

Open kristianmandrup opened this issue 8 years ago • 1 comments

Thought it would be cool if comments were passed through for documentation and usage such as enabling Flow type annotations, perhaps as an extension or plugin. Well, ideally I'd suggest support via a version line keyword flow. Could version keyword be enabled via extension!?

Flow/TS style arguments with default values and (optional) entry/exit types

const fn = ({ name = 'John Doe', age? : number }: Data): Data => ({
  name,
  age,
});

fn: ({name: 'John Doe', age}) -> ... could become fn: ({name: 'John Doe', age? <number> }) <Data> ->

We could start with limited flow support for function args and variable declarations

flow basics

c: "hello" <string>

What do you think?

kristianmandrup avatar Mar 05 '17 17:03 kristianmandrup

Supporting types is a long term plan. That may be after WebAssembly specification is more complete, so that we can directly compile FutureScript to WebAssembly.

zhanzhenzhen avatar Mar 07 '17 18:03 zhanzhenzhen