scala-js-ts-importer
scala-js-ts-importer copied to clipboard
correctly parse enum values
this pr fixes #103
enum values can be expressions including
- unary operators
- binary operators
- string and number literals
- parenthesis
- identifiers
See: https://github.com/microsoft/TypeScript/blob/master/doc/spec.md#92-enum-members https://github.com/microsoft/TypeScript/blob/master/doc/spec.md#419-binary-operators
Note: this implementation performs a flat parse that neither handles expression-tree-building nor operator precedences.
Note: This commit removes the minus from the NumericLit-token and parses it explicitly in TSDefParser.numberLiteral
The CI fails because it uses typescript 2.6.2 for checking the typedefinitions in samples. Sometime between that and the newest version ([email protected]) the allowed syntax seems to have been broadened, as it works for me locally.
TypeScript 2.6.2 was added just because it was latest when https://github.com/sjrd/scala-js-ts-importer/pull/56 was created. I think there is no reason to stay older TS, so it can be updated to 3.x.
ah ok. I did that. thx