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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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"]);