* 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
26 lines
517 B
TypeScript
26 lines
517 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'/>
|
|
module.exports = class Chunk {
|
|
constructor() {
|
|
this.chunk = 1;
|
|
}
|
|
}
|
|
|
|
// @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;
|