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

58 lines
1.4 KiB
Plaintext

=== tests/cases/conformance/jsdoc/declarations/base.js ===
class Base {
>Base : Base
constructor() {}
}
const BaseFactory = () => {
>BaseFactory : { (): Base; Base: typeof Base; }
>() => { return new Base();} : { (): Base; Base: typeof Base; }
return new Base();
>new Base() : Base
>Base : typeof Base
};
BaseFactory.Base = Base;
>BaseFactory.Base = Base : typeof Base
>BaseFactory.Base : typeof Base
>BaseFactory : { (): Base; Base: typeof Base; }
>Base : typeof Base
>Base : typeof Base
module.exports = BaseFactory;
>module.exports = BaseFactory : { (): Base; Base: typeof Base; }
>module.exports : { (): Base; Base: typeof Base; }
>module : { exports: { (): Base; Base: typeof Base; }; }
>exports : { (): Base; Base: typeof Base; }
>BaseFactory : { (): Base; Base: typeof Base; }
=== tests/cases/conformance/jsdoc/declarations/file.js ===
/** @typedef {import('./base')} BaseFactory */
/**
* @callback BaseFactoryFactory
* @param {import('./base')} factory
*/
/** @enum {import('./base')} */
const couldntThinkOfAny = {}
>couldntThinkOfAny : {}
>{} : {}
/**
*
* @param {InstanceType<BaseFactory["Base"]>} base
* @returns {InstanceType<BaseFactory["Base"]>}
*/
const test = (base) => {
>test : (base: InstanceType<BaseFactory["Base"]>) => Base
>(base) => { return base;} : (base: InstanceType<BaseFactory["Base"]>) => Base
>base : Base
return base;
>base : Base
};