mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-18 12:21:37 -06:00
Instantiate contextual this parameters if needed
This commit is contained in:
parent
f9d29370b6
commit
ad56220c45
@ -4632,6 +4632,9 @@ namespace ts {
|
||||
|
||||
function getThisTypeOfSignature(signature: Signature): Type | undefined {
|
||||
if (signature.thisParameter) {
|
||||
if (signature.mapper) {
|
||||
signature = instantiateSignature(signature, signature.mapper);
|
||||
}
|
||||
return getTypeOfSymbol(signature.thisParameter);
|
||||
}
|
||||
}
|
||||
@ -11770,6 +11773,10 @@ namespace ts {
|
||||
|
||||
function assignContextualParameterTypes(signature: Signature, context: Signature, mapper: TypeMapper) {
|
||||
const len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0);
|
||||
if (context.thisParameter) {
|
||||
// save the mapper in case we need to type `this` later
|
||||
context.mapper = mapper;
|
||||
}
|
||||
for (let i = 0; i < len; i++) {
|
||||
const parameter = signature.parameters[i];
|
||||
const contextualParameterType = getTypeAtPosition(context, i);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user