TypeScript/tests/cases/conformance/salsa/moduleExportAlias2.ts
Nathan Shively-Sanders 9ceb113ec5
Allow exports assignments (#23319)
1. Allow assignment to `exports`.
2. The type of the rhs is not checked against the type of `exports`
since they are aliased declarations.

To support more complex patterns like `exports = c.name = c`, we may
have to treat `c.name` as a declaration. That will be more complicated
than this PR.
2018-04-11 06:49:58 -07:00

20 lines
448 B
TypeScript

// @checkJs: true
// @allowJS: true
// @noEmit: true
// @Filename: node.d.ts
declare function require(name: string): any;
declare var exports: any;
declare var module: { exports: any };
// @Filename: semver.js
/// <reference path='node.d.ts' />
exports = module.exports = C
exports.f = n => n + 1
function C() {
this.p = 1
}
// @filename: index.js
/// <reference path='node.d.ts' />
const C = require("./semver")
var two = C.f(1)
var c = new C