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

48 lines
1.7 KiB
Plaintext

=== tests/cases/conformance/jsdoc/declarations/index.js ===
const Strings = {
>Strings : { a: string; b: string; }
>{ a: "A", b: "B"} : { a: string; b: string; }
a: "A",
>a : string
>"A" : "A"
b: "B"
>b : string
>"B" : "B"
};
module.exports = {
>module.exports = { thing: "ok", also: "ok", desc: { item: "ok" }} : { thing: string; also: string; desc: { item: string; }; Strings: { a: string; b: string; }; }
>module.exports : { thing: string; also: string; desc: { item: string; }; Strings: { a: string; b: string; }; }
>module : { exports: { thing: string; also: string; desc: { item: string; }; Strings: { a: string; b: string; }; }; }
>exports : { thing: string; also: string; desc: { item: string; }; Strings: { a: string; b: string; }; }
>{ thing: "ok", also: "ok", desc: { item: "ok" }} : { thing: string; also: string; desc: { item: string; }; }
thing: "ok",
>thing : string
>"ok" : "ok"
also: "ok",
>also : string
>"ok" : "ok"
desc: {
>desc : { item: string; }
>{ item: "ok" } : { item: string; }
item: "ok"
>item : string
>"ok" : "ok"
}
};
module.exports.Strings = Strings;
>module.exports.Strings = Strings : { a: string; b: string; }
>module.exports.Strings : { a: string; b: string; }
>module.exports : { thing: string; also: string; desc: { item: string; }; Strings: { a: string; b: string; }; }
>module : { exports: { thing: string; also: string; desc: { item: string; }; Strings: { a: string; b: string; }; }; }
>exports : { thing: string; also: string; desc: { item: string; }; Strings: { a: string; b: string; }; }
>Strings : { a: string; b: string; }
>Strings : { a: string; b: string; }