mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
isValidMethodAccess: use getTypeOfPropertyOfType instead of getTypeOfFuncClassEnumModule (#24488)
This commit is contained in:
parent
20e5617275
commit
5e2c7ffce6
@ -17428,7 +17428,7 @@ namespace ts {
|
||||
&& (!(property.flags & SymbolFlags.Method) || isValidMethodAccess(property, type));
|
||||
}
|
||||
function isValidMethodAccess(method: Symbol, actualThisType: Type): boolean {
|
||||
const propType = getTypeOfFuncClassEnumModule(method);
|
||||
const propType = getTypeOfPropertyOfType(actualThisType, method.escapedName)!;
|
||||
const signatures = getSignaturesOfType(getNonNullableType(propType), SignatureKind.Call);
|
||||
Debug.assert(signatures.length !== 0);
|
||||
return signatures.some(sig => {
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
//// value: T; // Make the type parameter actually matter
|
||||
//// ms(this: A<string>) {}
|
||||
//// mo(this: A<{}>) {}
|
||||
//// mt(this: A<T>) {}
|
||||
//// mp<P>(this: A<P>) {}
|
||||
//// mps<P extends string>(this: A<P>) {}
|
||||
////}
|
||||
@ -13,5 +14,5 @@
|
||||
////s./*s*/;
|
||||
////n./*n*/;
|
||||
|
||||
verify.completionsAt("s", ["value", "ms", "mo", "mp", "mps"]);
|
||||
verify.completionsAt("n", ["value", "mo", "mp"]);
|
||||
verify.completionsAt("s", ["value", "ms", "mo", "mt", "mp", "mps"]);
|
||||
verify.completionsAt("n", ["value", "mo", "mt", "mp"]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user