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

@@ -0,0 +1,13 @@
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: context.js
const obj = {
prop: 2,
method() {
this;
this.prop;
this.method;
this.unknown; // ok, obj has a string indexer
}
}