Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Instantiate contextual this parameters if needed
  • Loading branch information
sandersn committed Jul 14, 2016
commit ad56220c4562085b0d638d731269a7b327aeffa8
7 changes: 7 additions & 0 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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);
Expand Down