TypeScript/tests/baselines/reference/nestedDestructuringOfRequire.symbols
Nathan Shively-Sanders aba932aefa
Create synthetic exports symbol for commonjs module (#42655)
* 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
2021-02-05 10:56:03 -08:00

32 lines
876 B
Plaintext

=== tests/cases/conformance/salsa/main.js ===
const {
chalk: { grey }
>chalk : Symbol(chalk, Decl(mod1.js, 2, 2))
>grey : Symbol(grey, Decl(main.js, 1, 12))
} = require('./mod1');
>require : Symbol(require)
>'./mod1' : Symbol("tests/cases/conformance/salsa/mod1", Decl(mod1.js, 0, 0))
grey
>grey : Symbol(grey, Decl(main.js, 1, 12))
chalk
=== tests/cases/conformance/salsa/mod1.js ===
const chalk = {
>chalk : Symbol(chalk, Decl(mod1.js, 0, 5))
grey: {}
>grey : Symbol(grey, Decl(mod1.js, 0, 15))
};
module.exports.chalk = chalk
>module.exports.chalk : Symbol(chalk, Decl(mod1.js, 2, 2))
>module.exports : Symbol(chalk, Decl(mod1.js, 2, 2))
>module : Symbol(module, Decl(mod1.js, 2, 2))
>exports : Symbol(module.exports, Decl(mod1.js, 0, 0))
>chalk : Symbol(chalk, Decl(mod1.js, 2, 2))
>chalk : Symbol(chalk, Decl(mod1.js, 0, 5))