-
Notifications
You must be signed in to change notification settings - Fork 30k
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
TS: "Declare method" is really bad #94118
Comments
With this, it took me more keystrokes to fix the method compared to just writing it myself. |
Please provide steps to reproduce this issue in the VS Code codebase so we can investigate |
@mjbvz in |
Thanks. Point 1 is definitely a bug. I'll create a priority issue on TS for this Point 2 is microsoft/TypeScript#36249 but for declare method. I'll open a separate issue for that For point 3, TS should try to infer the return type based on context. In this case, the listener is typed to return function onSomething(e: (x: number) => number) { } // change this to 'any' to compare behavior
class Foo {
bar() {
onSomething(() => this.baz())
}
} The intent of quick fixes is to fix the issue, so we've avoid requiring user input on them |
TS should never suggest |
But in your example, it's our code that explicitly says the listener returns |
|
So many things wrong:
any
(!) is declared as return type??? I should be askedThe text was updated successfully, but these errors were encountered: