emuto icon indicating copy to clipboard operation
emuto copied to clipboard

Idea: add static type analysis

Open kantord opened this issue 6 years ago • 1 comments

This feature would consist in 3 different parts:

  • Add a syntax for type casting (it should actually be a special way to use functions that take a value and either return a casted value or throw an exception). It should handle type arguments, for example, array of string vs array of integer
  • Add casting functions for basic types (integer, array, etc.)
  • A static type checker as a separate package that can be used to find errors and generate flow/typescript types for the entire application (or modules)

kantord avatar Feb 09 '19 22:02 kantord

A simplified version of this might be just adding optional type notations to nested object projection, for example:

${
 author {
    (string) name
    (number) age
  }
}

These could be handled by a special function (passed to the compiler) that could produce TypeScript/flow annotations, while ignored by the interpreter

kantord avatar Feb 24 '19 13:02 kantord