[Bug] typescript type check
BayMax619 opened this issue · comments
BayMax619 commented
Reproducible in vscode.dev or in VS Code Desktop?
- Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
- Not reproducible in the monaco editor playground
Monaco Editor Playground Link
Monaco Editor Playground Code
class Test<T> {
}
class Test1 {
}
class Test2 {
}
declare class Global {
static tryGetBean(bean: string):string;
static tryGetBean(bean: number):number;
static tryGetBean(bean: Test<string>):number;
}
Global.tryGetBean('123');
Global.tryGetBean(123);
let test1: Test<string> = new Test<string>();
let test2: Test<number> = new Test<number>();
let test3 = new Test1();
Global.tryGetBean(test1);
// why no errors
Global.tryGetBean(test2);
Global.tryGetBean(test3);
Reproduction Steps
Global.tryGetBean method called without type check.
Actual (Problematic) Behavior
no errors
Expected Behavior
Global.tryGetBean(test2);
Global.tryGetBean(test3);
report should error
Additional Context
noStrictGenericChecks: false,
noImplicitAny: false,
j4k0xb commented
this isnt a monaco issue
TS is structurally typed and only compares properties, but Test
has none
e.g. with class Test<T> { value: T; }
it would error
see https://www.totaltypescript.com/the-empty-object-type-in-typescript