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

47 lines
1.4 KiB
Plaintext

=== tests/cases/conformance/jsdoc/declarations/index.js ===
const Obj = require("./obj");
>Obj : typeof Obj
>require("./obj") : typeof Obj
>require : any
>"./obj" : "./obj"
class Container {
>Container : Container
constructor() {
this.usage = new Obj();
>this.usage = new Obj() : Obj
>this.usage : any
>this : this
>usage : any
>new Obj() : Obj
>Obj : typeof Obj
}
}
module.exports = Container;
>module.exports = Container : typeof Container
>module.exports : typeof Container
>module : { exports: typeof Container; }
>exports : typeof Container
>Container : typeof Container
=== tests/cases/conformance/jsdoc/declarations/obj.js ===
module.exports = class Obj {
>module.exports = class Obj { constructor() { this.x = 12; }} : typeof import("tests/cases/conformance/jsdoc/declarations/obj")
>module.exports : typeof import("tests/cases/conformance/jsdoc/declarations/obj")
>module : { exports: typeof import("tests/cases/conformance/jsdoc/declarations/obj"); }
>exports : typeof import("tests/cases/conformance/jsdoc/declarations/obj")
>class Obj { constructor() { this.x = 12; }} : typeof import("tests/cases/conformance/jsdoc/declarations/obj")
>Obj : typeof import("tests/cases/conformance/jsdoc/declarations/obj")
constructor() {
this.x = 12;
>this.x = 12 : 12
>this.x : any
>this : this
>x : any
>12 : 12
}
}