Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] typescript type check #4467

Open
1 of 2 tasks
BayMax619 opened this issue Apr 12, 2024 · 1 comment
Open
1 of 2 tasks

[Bug] typescript type check #4467

BayMax619 opened this issue Apr 12, 2024 · 1 comment

Comments

@BayMax619
Copy link

BayMax619 commented Apr 12, 2024

Reproducible in vscode.dev or in VS Code Desktop?

  • Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.47.0#XQAAAALkBAAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw7VuRmAlP8UHl2wTDSACH-qdgDy04VOvD7Jmc6fs3N2mfiPPtNst-DOIbdc9WJIeJWkZ_8CKRyWOAPtv8hjI2Q2FNfCzKK6_qZOxN-SICsCgqt89H-1cX5-iQ-rI1OUyebpgJrcyYrLSaQuHGmc2O7p3waofGmpJ2_RqEA05xpQ9qNCFTGnCpb2RZbnIymB9i78qLLlfq3SAM8KuTfthQ5BEQ2gGRBT6kb_wsQAkaAWRWe_2LcbzC4D2kxo5IgQ0p3R_ERItVwZe1afxNhUNwfdJm9-GeX8T6PInV70kUsPIJJtAz9UeNspMaIRZre84RqmaXLa_fBdXnGMVmtihaWn1lFJfESDCQXkXU0wySzW8dFYOwnBwJN1xkBIS65yY6SbG9V5csxIvok2JwFuNDKkb9fBNJlRYt5CQFA7ni5DoqIJcZAlJyPVhXHdYkHg-VwcU5CdAsbIz0EcYBqc7CbPBfxKSJZTPPGVEJAPGTg_uo2rN0X1KFdxUK_-giUwnQsKWs-SYsETbkclSir1oiiAeuCO9SkbIyYt88NnIna47YYs01uSQSNZ9uZ8krC5Vt9fdwoMjcIT3IYk9oRLfj_FNIsatiMux24bZpRRkc322AO_0if3GxgkoE2qsoftcgLsHgzCGpnaJ0W81B82_QKQ00HiJegCUUhz3LBJh_uBcQZTI6lmk8M06gaSXPbvVgfukY4u9zac9fqf0wUyo

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
Copy link

j4k0xb commented Apr 20, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants