9ceb113ec5
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.
19 lines
448 B
TypeScript
19 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
|