emuto
emuto copied to clipboard
Idea: add static type analysis
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)
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