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

52 lines
1.5 KiB
Plaintext

=== tests/cases/conformance/jsdoc/declarations/base.js ===
class Base {
>Base : Symbol(Base, Decl(base.js, 0, 0))
constructor() {}
}
const BaseFactory = () => {
>BaseFactory : Symbol(BaseFactory, Decl(base.js, 4, 5), Decl(base.js, 6, 2))
return new Base();
>Base : Symbol(Base, Decl(base.js, 0, 0))
};
BaseFactory.Base = Base;
>BaseFactory.Base : Symbol(BaseFactory.Base, Decl(base.js, 6, 2))
>BaseFactory : Symbol(BaseFactory, Decl(base.js, 4, 5), Decl(base.js, 6, 2))
>Base : Symbol(BaseFactory.Base, Decl(base.js, 6, 2))
>Base : Symbol(Base, Decl(base.js, 0, 0))
module.exports = BaseFactory;
>module.exports : Symbol(module.exports, Decl(base.js, 0, 0))
>module : Symbol(export=, Decl(base.js, 8, 24))
>exports : Symbol(export=, Decl(base.js, 8, 24))
>BaseFactory : Symbol(BaseFactory, Decl(base.js, 4, 5), Decl(base.js, 6, 2))
=== tests/cases/conformance/jsdoc/declarations/file.js ===
/** @typedef {import('./base')} BaseFactory */
/**
* @callback BaseFactoryFactory
* @param {import('./base')} factory
*/
/** @enum {import('./base')} */
const couldntThinkOfAny = {}
>couldntThinkOfAny : Symbol(couldntThinkOfAny, Decl(file.js, 6, 5), Decl(file.js, 5, 4))
/**
*
* @param {InstanceType<BaseFactory["Base"]>} base
* @returns {InstanceType<BaseFactory["Base"]>}
*/
const test = (base) => {
>test : Symbol(test, Decl(file.js, 13, 5))
>base : Symbol(base, Decl(file.js, 13, 14))
return base;
>base : Symbol(base, Decl(file.js, 13, 14))
};