aba932aefa
* Commonjs module:create synthetic exports symbol Previously, the `module` identifier in commonjs modules got a synthetic type with a single property `exports`. The exports property reused the file's symbol, which, for a module file, gives the correct exported properties. However, the name of this symbol was still the filename of the file, not `exports`. This PR creates a synthetic symbol for `exports` by copying in a similar way to esModuleInterop's `default` symbol in `resolveESModuleSymbol` (although the intent there is to strip off signatures from the symbol). * correct parent of synthetic symbol
60 lines
1.5 KiB
Plaintext
60 lines
1.5 KiB
Plaintext
=== tests/cases/conformance/jsdoc/use.js ===
|
|
/// <reference path='./types.d.ts'/>
|
|
/** @typedef {import("./mod1")} C
|
|
* @type {C} */
|
|
var c;
|
|
>c : D
|
|
|
|
c.chunk;
|
|
>c.chunk : number
|
|
>c : D
|
|
>chunk : number
|
|
|
|
const D = require("./mod1");
|
|
>D : typeof D
|
|
>require("./mod1") : typeof D
|
|
>require : (name: string) => any
|
|
>"./mod1" : "./mod1"
|
|
|
|
/** @type {D} */
|
|
var d;
|
|
>d : D
|
|
|
|
d.chunk;
|
|
>d.chunk : number
|
|
>d : D
|
|
>chunk : number
|
|
|
|
=== tests/cases/conformance/jsdoc/types.d.ts ===
|
|
declare function require(name: string): any;
|
|
>require : (name: string) => any
|
|
>name : string
|
|
|
|
declare var exports: any;
|
|
>exports : any
|
|
|
|
declare var module: { exports: any };
|
|
>module : { exports: any; }
|
|
>exports : any
|
|
|
|
=== tests/cases/conformance/jsdoc/mod1.js ===
|
|
/// <reference path='./types.d.ts'/>
|
|
module.exports = class Chunk {
|
|
>module.exports = class Chunk { constructor() { this.chunk = 1; }} : typeof import("tests/cases/conformance/jsdoc/mod1")
|
|
>module.exports : typeof import("tests/cases/conformance/jsdoc/mod1")
|
|
>module : { exports: typeof import("tests/cases/conformance/jsdoc/mod1"); }
|
|
>exports : typeof import("tests/cases/conformance/jsdoc/mod1")
|
|
>class Chunk { constructor() { this.chunk = 1; }} : typeof import("tests/cases/conformance/jsdoc/mod1")
|
|
>Chunk : typeof import("tests/cases/conformance/jsdoc/mod1")
|
|
|
|
constructor() {
|
|
this.chunk = 1;
|
|
>this.chunk = 1 : 1
|
|
>this.chunk : any
|
|
>this : this
|
|
>chunk : any
|
|
>1 : 1
|
|
}
|
|
}
|
|
|