Closed
Description
TypeScript Version: nightly
Search Terms: "did you mean to call"
Code
declare const variable: () => void;
class Foo {
method!: (() => void);
f() {
// Error (incorrect)
if (this.method) {
this.method();
}
// OK (correct)
if (variable) {
variable();
}
}
}
Expected behavior: No error
Actual behavior: Error: This condition will always return true; did you mean to call it instead?
Playground Link: Linky
Related Issues: Feature introduced at PR #37152