mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-12 11:08:26 -05:00
Fix bug: getNonNullableType before getting signatures of method (#21212)
This commit is contained in:
@@ -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);
|
||||
|
||||
8
tests/cases/fourslash/completionsOptionalMethod.ts
Normal file
8
tests/cases/fourslash/completionsOptionalMethod.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @strictNullChecks: true
|
||||
|
||||
////declare const x: { m?(): void };
|
||||
////x./**/
|
||||
|
||||
verify.completionsAt("", ["m"]);
|
||||
Reference in New Issue
Block a user