Skip to content
This repository was archived by the owner on Feb 19, 2018. It is now read-only.
This repository was archived by the owner on Feb 19, 2018. It is now read-only.

CS2 Discussion: Features: Type Annotations #12

Closed
@rattrayalex

Description

@rattrayalex

I've assumed it'd be next to impossible to add type annotations to CoffeeScript, but thought we should open an issue to discuss if it might be possible. Static Typing is undergoing a renaissance of sorts these days, with developers flocking to new statically typed languages and adding static annotations to dynamic languages like Python (see PEP484) and JavaScript (via Flow and TypeScript).

Flow supports gradual typing for JavaScript, and has some decent tooling to make development easier. They have loose plans to ingest an ESTree AST, which could allow integration of Flow and CS6.

I don't think TypeScript would be a viable target for CS6, as it doesn't play well with Babel (a probable target of CS6) and requires "complete type coverage", which wouldn't likely gel well with CoffeeScript developers, who don't like typing (pardon the pun).

While this would be awesome, I struggle to see how it could work, at least with Flow-like syntax and readability:

obj: {[id:string]: number} = 
  thing: 7
myFn(a: []number, b: number): []number ->
  a.map(x -> x + b)
myFnThatTakesACallback(a: number, cb: (id: number) => Promise<number>): Promise<number> => 
  cb(a).then(x => x + 1)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions