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

48 lines
1.2 KiB
Plaintext

=== tests/cases/conformance/jsdoc/declarations/utils/index.js ===
// issue arises here on compilation
const errors = require("./errors");
>errors : typeof errors
>require("./errors") : typeof errors
>require : any
>"./errors" : "./errors"
module.exports = {
>module.exports = { errors} : typeof module.exports
>module.exports : typeof module.exports
>module : { exports: typeof module.exports; }
>exports : typeof module.exports
>{ errors} : { errors: typeof errors; }
errors
>errors : typeof errors
};
=== tests/cases/conformance/jsdoc/declarations/utils/errors.js ===
class FancyError extends Error {
>FancyError : FancyError
>Error : Error
constructor(status) {
>status : any
super(`error with status ${status}`);
>super(`error with status ${status}`) : void
>super : ErrorConstructor
>`error with status ${status}` : string
>status : any
}
}
module.exports = {
>module.exports = { FancyError} : typeof module.exports
>module.exports : typeof module.exports
>module : { exports: typeof module.exports; }
>exports : typeof module.exports
>{ FancyError} : { FancyError: typeof FancyError; }
FancyError
>FancyError : typeof FancyError
};