Fix bug: getNonNullableType before getting signatures of method (#21212)

This commit is contained in:
Andy
2018-01-17 11:27:21 -08:00
committed by GitHub
parent 004f18ff0c
commit c549bb5737
2 changed files with 9 additions and 1 deletions

View File

@@ -15815,7 +15815,7 @@ namespace ts {
}
function isValidMethodAccess(method: Symbol, type: Type) {
const propType = getTypeOfFuncClassEnumModule(method);
const signatures = getSignaturesOfType(propType, SignatureKind.Call);
const signatures = getSignaturesOfType(getNonNullableType(propType), SignatureKind.Call);
Debug.assert(signatures.length !== 0);
return signatures.some(sig => {
const thisType = getThisTypeOfSignature(sig);

View File

@@ -0,0 +1,8 @@
/// <reference path="fourslash.ts" />
// @strictNullChecks: true
////declare const x: { m?(): void };
////x./**/
verify.completionsAt("", ["m"]);