TypeScript/tests/baselines/reference/jsDeclarationsExportAssignmentExpressionPlusSecondary.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

38 lines
1 KiB
Plaintext

=== tests/cases/conformance/jsdoc/declarations/index.js ===
const Strings = {
>Strings : Symbol(Strings, Decl(index.js, 0, 5))
a: "A",
>a : Symbol(a, Decl(index.js, 0, 17))
b: "B"
>b : Symbol(b, Decl(index.js, 1, 11))
};
module.exports = {
>module.exports : Symbol(module.exports, Decl(index.js, 0, 0))
>module : Symbol(export=, Decl(index.js, 3, 2))
>exports : Symbol(export=, Decl(index.js, 3, 2))
thing: "ok",
>thing : Symbol(thing, Decl(index.js, 4, 18))
also: "ok",
>also : Symbol(also, Decl(index.js, 5, 16))
desc: {
>desc : Symbol(desc, Decl(index.js, 6, 15))
item: "ok"
>item : Symbol(item, Decl(index.js, 7, 11))
}
};
module.exports.Strings = Strings;
>module.exports.Strings : Symbol(Strings, Decl(index.js, 10, 2))
>module.exports : Symbol(Strings, Decl(index.js, 10, 2))
>module : Symbol(module, Decl(index.js, 3, 2))
>exports : Symbol(module.exports, Decl(index.js, 0, 0))
>Strings : Symbol(Strings, Decl(index.js, 10, 2))
>Strings : Symbol(Strings, Decl(index.js, 0, 5))