Closed nbrahms closed 3 years ago
The typeof keyword has a slightly unexpected precedence in a typed context. That is,
type Foo = typeof my_array[number]
should be interpreted as
type Foo = ((typeof my_array)[number])
This commit fixes this grammar to have the above precedence.
This can be confirmed by attempting to type-check the following code:
const my_array = ["a", "b", "c"]; type MA = (typeof my_array)[number]; // MA = "string" type MB = typeof (my_array[number]); // throws errors
Note that this leaves a similar issue (#149) with keyof lookups unresolved.
Fixes #141.
Thanks!
The typeof keyword has a slightly unexpected precedence in a typed context. That is,
type Foo = typeof my_array[number]
should be interpreted as
type Foo = ((typeof my_array)[number])
This commit fixes this grammar to have the above precedence.
This can be confirmed by attempting to type-check the following code:
const my_array = ["a", "b", "c"]; type MA = (typeof my_array)[number]; // MA = "string" type MB = typeof (my_array[number]); // throws errors
Note that this leaves a similar issue (#149) with keyof lookups unresolved.
Fixes #141.