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

118 lines
3.4 KiB
Plaintext

=== tests/cases/conformance/jsdoc/declarations/cls.js ===
export class Foo {}
>Foo : Foo
=== tests/cases/conformance/jsdoc/declarations/func.js ===
export function func() {}
>func : () => void
=== tests/cases/conformance/jsdoc/declarations/bar.js ===
export * from "./cls";
No type information for this code.
No type information for this code.=== tests/cases/conformance/jsdoc/declarations/bar2.js ===
export * from "./func";
No type information for this code.export * from "./cls";
No type information for this code.
No type information for this code.=== tests/cases/conformance/jsdoc/declarations/baz.js ===
import {Foo} from "./cls";
>Foo : typeof Foo
export {Foo};
>Foo : typeof Foo
=== tests/cases/conformance/jsdoc/declarations/bat.js ===
import * as ns from "./cls";
>ns : typeof ns
export default ns;
>ns : typeof ns
=== tests/cases/conformance/jsdoc/declarations/ban.js ===
import * as ns from "./cls";
>ns : typeof ns
export {ns};
>ns : typeof ns
=== tests/cases/conformance/jsdoc/declarations/bol.js ===
import * as ns from "./cls";
>ns : typeof ns
export { ns as classContainer };
>ns : typeof ns
>classContainer : typeof ns
=== tests/cases/conformance/jsdoc/declarations/cjs.js ===
const ns = require("./cls");
>ns : typeof ns
>require("./cls") : typeof ns
>require : any
>"./cls" : "./cls"
module.exports = { ns };
>module.exports = { ns } : typeof module.exports
>module.exports : typeof module.exports
>module : { exports: typeof module.exports; }
>exports : typeof module.exports
>{ ns } : { ns: typeof ns; }
>ns : typeof ns
=== tests/cases/conformance/jsdoc/declarations/cjs2.js ===
const ns = require("./cls");
>ns : typeof ns
>require("./cls") : typeof ns
>require : any
>"./cls" : "./cls"
module.exports = ns;
>module.exports = ns : typeof ns
>module.exports : typeof ns
>module : { exports: typeof ns; }
>exports : typeof ns
>ns : typeof ns
=== tests/cases/conformance/jsdoc/declarations/cjs3.js ===
const ns = require("./cls");
>ns : typeof ns
>require("./cls") : typeof ns
>require : any
>"./cls" : "./cls"
module.exports.ns = ns;
>module.exports.ns = ns : typeof ns
>module.exports.ns : typeof ns
>module.exports : typeof module.exports
>module : { exports: typeof module.exports; }
>exports : typeof module.exports
>ns : typeof ns
>ns : typeof ns
=== tests/cases/conformance/jsdoc/declarations/cjs4.js ===
const ns = require("./cls");
>ns : typeof ns
>require("./cls") : typeof ns
>require : any
>"./cls" : "./cls"
module.exports.names = ns;
>module.exports.names = ns : typeof ns
>module.exports.names : typeof ns
>module.exports : typeof module.exports
>module : { exports: typeof module.exports; }
>exports : typeof module.exports
>names : typeof ns
>ns : typeof ns
=== tests/cases/conformance/jsdoc/declarations/includeAll.js ===
import "./cjs4";
No type information for this code.import "./cjs3";
No type information for this code.import "./cjs2";
No type information for this code.import "./cjs";
No type information for this code.import "./bol";
No type information for this code.import "./ban";
No type information for this code.import "./bat";
No type information for this code.import "./baz";
No type information for this code.import "./bar";
No type information for this code.import "./bar2";
No type information for this code.
No type information for this code.