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

56 lines
1.4 KiB
Plaintext

=== tests/cases/conformance/jsdoc/MC.js ===
const MW = require("./MW");
>MW : typeof MW
>require("./MW") : typeof MW
>require : any
>"./MW" : "./MW"
/** @typedef {number} Cictema */
module.exports = class MC {
>module.exports = class MC { watch() { return new MW(this); }} : typeof import("tests/cases/conformance/jsdoc/MC")
>module.exports : typeof import("tests/cases/conformance/jsdoc/MC")
>module : { exports: typeof import("tests/cases/conformance/jsdoc/MC"); }
>exports : typeof import("tests/cases/conformance/jsdoc/MC")
>class MC { watch() { return new MW(this); }} : typeof import("tests/cases/conformance/jsdoc/MC")
>MC : typeof import("tests/cases/conformance/jsdoc/MC")
watch() {
>watch : () => MW
return new MW(this);
>new MW(this) : MW
>MW : typeof MW
>this : this
}
};
=== tests/cases/conformance/jsdoc/MW.js ===
/** @typedef {import("./MC")} MC */
class MW {
>MW : MW
/**
* @param {MC} compiler the compiler
*/
constructor(compiler) {
>compiler : import("tests/cases/conformance/jsdoc/MC")
this.compiler = compiler;
>this.compiler = compiler : import("tests/cases/conformance/jsdoc/MC")
>this.compiler : any
>this : this
>compiler : any
>compiler : import("tests/cases/conformance/jsdoc/MC")
}
}
module.exports = MW;
>module.exports = MW : typeof MW
>module.exports : typeof MW
>module : { exports: typeof MW; }
>exports : typeof MW
>MW : typeof MW