-
-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Type checker does not detect a signature mismatch
Fixes: #2727
- Loading branch information
1 parent
eedf306
commit 927b7cd
Showing
4 changed files
with
42 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"asc_flags": [], | ||
"stderr": [ | ||
"TS2322: Type '() => void' is not assignable to type '(this: class-member-function-as-parameter/A) => void'.", | ||
"TS2322: Type '(this: class-member-function-as-parameter/B) => void' is not assignable to type '(this: class-member-function-as-parameter/A) => void'.", | ||
"EOF" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
class A { | ||
foo(): void { } | ||
} | ||
|
||
class B extends A { | ||
foo(): void { } | ||
} | ||
|
||
function foo(): void { } | ||
|
||
function consumeA(callback: (this: A) => void): void { } | ||
function consumeB(callback: (this: B) => void): void { } | ||
|
||
const a = new A(); | ||
const b = new B(); | ||
|
||
consumeB(a.foo); // shouldn't error | ||
consumeA(foo); // should error | ||
consumeA(b.foo); // should error | ||
ERROR("EOF"); |