File tree 1 file changed +4
-4
lines changed 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -11601,7 +11601,7 @@ namespace ts {
11601
11601
}
11602
11602
}
11603
11603
}
11604
- if (compilerOptions. noImplicitThis) {
11604
+ if (noImplicitThis) {
11605
11605
const containingLiteral = getContainingObjectLiteral(func);
11606
11606
if (containingLiteral) {
11607
11607
// We have an object literal method. Check if the containing object literal has a contextual type
@@ -11622,9 +11622,9 @@ namespace ts {
11622
11622
type = getApparentTypeOfContextualType(literal);
11623
11623
}
11624
11624
// There was no contextual ThisType<T> for the containing object literal, so the contextual type
11625
- // for 'this' is the contextual type for the containing object literal or the type of the object
11626
- // literal itself.
11627
- return contextualType || checkExpressionCached(containingLiteral);
11625
+ // for 'this' is the non-null form of the contextual type for the containing object literal or
11626
+ // the type of the object literal itself.
11627
+ return contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral);
11628
11628
}
11629
11629
// In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the
11630
11630
// contextual type for 'this' is 'obj'.
You can’t perform that action at this time.
0 commit comments