Skip to content

Commit c549bb5

Browse files
author
Andy
authored
Fix bug: getNonNullableType before getting signatures of method (#21212)
1 parent 004f18f commit c549bb5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15815,7 +15815,7 @@ namespace ts {
1581515815
}
1581615816
function isValidMethodAccess(method: Symbol, type: Type) {
1581715817
const propType = getTypeOfFuncClassEnumModule(method);
15818-
const signatures = getSignaturesOfType(propType, SignatureKind.Call);
15818+
const signatures = getSignaturesOfType(getNonNullableType(propType), SignatureKind.Call);
1581915819
Debug.assert(signatures.length !== 0);
1582015820
return signatures.some(sig => {
1582115821
const thisType = getThisTypeOfSignature(sig);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @strictNullChecks: true
4+
5+
////declare const x: { m?(): void };
6+
////x./**/
7+
8+
verify.completionsAt("", ["m"]);

0 commit comments

Comments
 (0)