TypeScript Version: 4.2.0-dev.20201211 (also tested with 4.2.0)
Search Terms: static method(s)
Code
classS{staticf(a: number|string): void{}}functiong(a: number): void{}// Uncomment to see a different behavior of the `output` const type.// type G = typeof g;consty=[S.f,g];constoutput: ((ctrl: number|string)=>void)[]=y;Expected behavior:
Consistent type checking result (an error) for the output const with and without type G = typeof g.
Actual behavior:
If the type G = typeof g is present, the error is thrown (as expected), otherwise there is no error thrown.
Playground Link:
Playground link to reproduce the error.
// cc Alex Rickabaugh (@alxhub)Rado Kirov (@rkirov)
TypeScript Version: 4.2.0-dev.20201211 (also tested with 4.2.0)
Search Terms: static method(s)
Code
Expected behavior:
Consistent type checking result (an error) for the
outputconst with and withouttype G = typeof g.Actual behavior:
If the
type G = typeof gis present, the error is thrown (as expected), otherwise there is no error thrown.Playground Link:
Playground link to reproduce the error.
// cc Alex Rickabaugh (@alxhub)Rado Kirov (@rkirov)