Merge pull request #17252 from Microsoft/contextually-type-this-in-object-literals-in-javascript

Contextually type this in object literals in JS
This commit is contained in:
Nathan Shively-Sanders
2017-07-18 10:18:10 -07:00
committed by GitHub
4 changed files with 74 additions and 1 deletions

View File

@@ -12662,7 +12662,7 @@ namespace ts {
}
}
}
if (noImplicitThis) {
if (noImplicitThis || isInJavaScriptFile(func)) {
const containingLiteral = getContainingObjectLiteral(func);
if (containingLiteral) {
// We have an object literal method. Check if the containing object literal has a contextual type