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

30 lines
1 KiB
Plaintext

=== tests/cases/conformance/jsdoc/declarations/index.js ===
// @ts-nocheck
function foo() {
>foo : Symbol(foo, Decl(index.js, 0, 0))
module.exports = exports = function (o) {
>module.exports : Symbol(module.exports, Decl(index.js, 0, 0))
>module : Symbol(export=, Decl(index.js, 1, 16))
>exports : Symbol(export=, Decl(index.js, 1, 16))
>exports : Symbol("tests/cases/conformance/jsdoc/declarations/index", Decl(index.js, 0, 0))
>o : Symbol(o, Decl(index.js, 2, 41))
return (o == null) ? create(base) : defineProperties(Object(o), descriptors);
>o : Symbol(o, Decl(index.js, 2, 41))
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>o : Symbol(o, Decl(index.js, 2, 41))
};
const m = function () {
>m : Symbol(m, Decl(index.js, 5, 9))
// I have no idea what to put here
}
exports.methods = m;
>exports : Symbol(methods, Decl(index.js, 7, 5))
>methods : Symbol(methods, Decl(index.js, 7, 5))
>m : Symbol(m, Decl(index.js, 5, 9))
}