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

41 lines
1.3 KiB
Plaintext

=== tests/cases/conformance/jsdoc/declarations/utils/index.js ===
// issue arises here on compilation
const errors = require("./errors");
>errors : Symbol(errors, Decl(index.js, 1, 5))
>require : Symbol(require)
>"./errors" : Symbol(errors, Decl(errors.js, 0, 0))
module.exports = {
>module.exports : Symbol(module.exports, Decl(index.js, 0, 0))
>module : Symbol(module, Decl(index.js, 1, 35))
>exports : Symbol(module.exports, Decl(index.js, 0, 0))
errors
>errors : Symbol(errors, Decl(index.js, 3, 18))
};
=== tests/cases/conformance/jsdoc/declarations/utils/errors.js ===
class FancyError extends Error {
>FancyError : Symbol(FancyError, Decl(errors.js, 0, 0))
>Error : Symbol(Error, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
constructor(status) {
>status : Symbol(status, Decl(errors.js, 1, 16))
super(`error with status ${status}`);
>super : Symbol(ErrorConstructor, Decl(lib.es5.d.ts, --, --))
>status : Symbol(status, Decl(errors.js, 1, 16))
}
}
module.exports = {
>module.exports : Symbol(module.exports, Decl(errors.js, 0, 0))
>module : Symbol(module, Decl(errors.js, 4, 1))
>exports : Symbol(module.exports, Decl(errors.js, 0, 0))
FancyError
>FancyError : Symbol(FancyError, Decl(errors.js, 6, 18))
};