Closed msujew closed 4 weeks ago
Langium version: 3.0 Package name: langium
langium
Create a parser rule like:
A: items+=ID items+=NUMBER; terminal ID returns string: ...; terminal NUMBER returns number: ...;
This generates an unexpected type, see below.
The type below is both unexpected as well as difficult to work with. A unioned array element type would be preferable here.
The parser rule above will be generated as:
interface A extends AstNode { $type: 'A'; items: Array<number> | Array<string> }
The expected type would be
interface A extends AstNode { $type: 'A'; - items: Array<number> | Array<string> + items: Array<number | string> }
Note that the type union has been pulled into the array.
Langium version: 3.0 Package name:
langium
Steps To Reproduce
Create a parser rule like:
This generates an unexpected type, see below.
The type below is both unexpected as well as difficult to work with. A unioned array element type would be preferable here.
The current behavior
The parser rule above will be generated as:
The expected behavior
The expected type would be
Note that the type union has been pulled into the array.