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

44 lines
1.4 KiB
Plaintext

=== tests/cases/conformance/jsdoc/declarations/index.js ===
class A {
>A : A
member = new Q();
>member : Q
>new Q() : Q
>Q : typeof Q
}
class Q {
>Q : Q
x = 42;
>x : number
>42 : 42
}
module.exports = class Q {
>module.exports = class Q { constructor() { this.x = new A(); }} : typeof import("tests/cases/conformance/jsdoc/declarations/index")
>module.exports : typeof import("tests/cases/conformance/jsdoc/declarations/index")
>module : { exports: typeof import("tests/cases/conformance/jsdoc/declarations/index"); }
>exports : typeof import("tests/cases/conformance/jsdoc/declarations/index")
>class Q { constructor() { this.x = new A(); }} : typeof import("tests/cases/conformance/jsdoc/declarations/index")
>Q : typeof import("tests/cases/conformance/jsdoc/declarations/index")
constructor() {
this.x = new A();
>this.x = new A() : A
>this.x : any
>this : this
>x : any
>new A() : A
>A : typeof A
}
}
module.exports.Another = Q;
>module.exports.Another = Q : typeof Q
>module.exports.Another : typeof Q
>module.exports : typeof import("tests/cases/conformance/jsdoc/declarations/index")
>module : { exports: typeof import("tests/cases/conformance/jsdoc/declarations/index"); }
>exports : typeof import("tests/cases/conformance/jsdoc/declarations/index")
>Another : typeof Q
>Q : typeof Q