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

27 lines
1 KiB
Plaintext

=== tests/cases/conformance/jsdoc/declarations/reexport.js ===
'use strict';
const Thing = require('./thing').Thing
>Thing : Symbol(Thing, Decl(reexport.js, 1, 5))
>require('./thing').Thing : Symbol(Thing, Decl(thing.js, 2, 18))
>require : Symbol(require)
>'./thing' : Symbol("tests/cases/conformance/jsdoc/declarations/thing", Decl(thing.js, 0, 0))
>Thing : Symbol(Thing, Decl(thing.js, 2, 18))
module.exports = { Thing }
>module.exports : Symbol(module.exports, Decl(reexport.js, 0, 0))
>module : Symbol(module, Decl(reexport.js, 1, 38))
>exports : Symbol(module.exports, Decl(reexport.js, 0, 0))
>Thing : Symbol(Thing, Decl(reexport.js, 2, 18))
=== tests/cases/conformance/jsdoc/declarations/thing.js ===
'use strict';
class Thing {}
>Thing : Symbol(Thing, Decl(thing.js, 0, 13))
module.exports = { Thing }
>module.exports : Symbol(module.exports, Decl(thing.js, 0, 0))
>module : Symbol(module, Decl(thing.js, 1, 14))
>exports : Symbol(module.exports, Decl(thing.js, 0, 0))
>Thing : Symbol(Thing, Decl(thing.js, 2, 18))