TypeScript/tests/cases/compiler/commonjsAccessExports.ts
Andy d1e2242ee4 Allow to access exports from inside a commonjs module (#17745)
* Allow to access `exports` from inside a commonjs module

* Don't contextually type `this` in `exports.f = function() { ... }`

* Update test
2017-09-14 12:36:55 -07:00

19 lines
308 B
TypeScript

// @module: commonjs
// @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: /a.js
exports.x = 0;
exports.x;
// Works nested
{
// 'exports' does not provide a contextual type to a function-class
exports.Cls = function() {
this.x = 0;
}
}
const instance = new exports.Cls();