TypeScript/tests/cases/conformance/jsdoc/jsdocImportType.ts
Nathan Shively-Sanders 905f9a02ad
module.exports = Entity is an alias, just like export = Entity (#23570)
* Make `module.export =` an alias like `export=` is

This breaks a couple of tests for previous workarounds. Fix in upcoming
commits.

* Basically fixes all the breaks, but needs cleanup

* More notes to myself

* Clean up TODOs

* Call mergeSymbolTable and delete export= afterward

instead of basically copying the code myself.

* More cleanup

* Remove unnecessary check in import type checking

* Revert to DIY code.

It is more correct and will go away in a few days.

* Exported class expressions can be used as type

In both JS and TS

* Do not require named class expressions
2018-04-23 15:24:31 -07:00

28 lines
524 B
TypeScript

// @allowJs: true
// @checkJs: true
// @noEmit: true
// @Filename: types.d.ts
declare function require(name: string): any;
declare var exports: any;
declare var module: { exports: any };
// @Filename: mod1.js
/// <reference path='./types.d.ts'/>
class Chunk {
constructor() {
this.chunk = 1;
}
}
module.exports = Chunk;
// @Filename: use.js
/// <reference path='./types.d.ts'/>
/** @typedef {import("./mod1")} C
* @type {C} */
var c;
c.chunk;
const D = require("./mod1");
/** @type {D} */
var d;
d.chunk;