Skip to content

Commit 2ca6164

Browse files
committed
Default contextual 'this' type is containing object literal
1 parent 8cd6c5d commit 2ca6164

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/compiler/checker.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11230,6 +11230,9 @@ namespace ts {
1123011230
}
1123111231
objectLiteral = <ObjectLiteralExpression>objectLiteral.parent.parent;
1123211232
}
11233+
// There was no contextual ThisType<T> for the containing object literal, so the contextual type
11234+
// for 'this' is the type of the object literal itself.
11235+
return checkExpressionCached(containingLiteral);
1123311236
}
1123411237
}
1123511238
return undefined;

0 commit comments

Comments
 (0)