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
30 lines
919 B
Plaintext
30 lines
919 B
Plaintext
=== tests/cases/conformance/jsdoc/declarations/folder/mod1.js ===
|
|
/**
|
|
* @typedef {{x: number}} Item
|
|
*/
|
|
/**
|
|
* @type {Item};
|
|
*/
|
|
const x = {x: 12};
|
|
>x : Symbol(x, Decl(mod1.js, 6, 5))
|
|
>x : Symbol(x, Decl(mod1.js, 6, 11))
|
|
|
|
module.exports = x;
|
|
>module.exports : Symbol(module.exports, Decl(mod1.js, 0, 0))
|
|
>module : Symbol(export=, Decl(mod1.js, 6, 18))
|
|
>exports : Symbol(export=, Decl(mod1.js, 6, 18))
|
|
>x : Symbol(x, Decl(mod1.js, 6, 5))
|
|
|
|
=== tests/cases/conformance/jsdoc/declarations/index.js ===
|
|
/** @type {(typeof import("./folder/mod1"))[]} */
|
|
const items = [{x: 12}];
|
|
>items : Symbol(items, Decl(index.js, 1, 5))
|
|
>x : Symbol(x, Decl(index.js, 1, 16))
|
|
|
|
module.exports = items;
|
|
>module.exports : Symbol(module.exports, Decl(index.js, 0, 0))
|
|
>module : Symbol(export=, Decl(index.js, 1, 24))
|
|
>exports : Symbol(export=, Decl(index.js, 1, 24))
|
|
>items : Symbol(items, Decl(index.js, 1, 5))
|
|
|