aba932aefa
* 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
77 lines
2.4 KiB
Plaintext
77 lines
2.4 KiB
Plaintext
=== tests/cases/conformance/jsdoc/declarations/index.js ===
|
|
export {}; // flag file as module
|
|
No type information for this code./**
|
|
No type information for this code. * @typedef {string | number | symbol} PropName
|
|
No type information for this code. */
|
|
No type information for this code.
|
|
No type information for this code./**
|
|
No type information for this code. * Callback
|
|
No type information for this code. *
|
|
No type information for this code. * @callback NumberToStringCb
|
|
No type information for this code. * @param {number} a
|
|
No type information for this code. * @returns {string}
|
|
No type information for this code. */
|
|
No type information for this code.
|
|
No type information for this code./**
|
|
No type information for this code. * @template T
|
|
No type information for this code. * @typedef {T & {name: string}} MixinName
|
|
No type information for this code. */
|
|
No type information for this code.
|
|
No type information for this code./**
|
|
No type information for this code. * Identity function
|
|
No type information for this code. *
|
|
No type information for this code. * @template T
|
|
No type information for this code. * @callback Identity
|
|
No type information for this code. * @param {T} x
|
|
No type information for this code. * @returns {T}
|
|
No type information for this code. */
|
|
No type information for this code.
|
|
No type information for this code.=== tests/cases/conformance/jsdoc/declarations/mixed.js ===
|
|
/**
|
|
* @typedef {{x: string} | number | LocalThing | ExportedThing} SomeType
|
|
*/
|
|
/**
|
|
* @param {number} x
|
|
* @returns {SomeType}
|
|
*/
|
|
function doTheThing(x) {
|
|
>doTheThing : (x: number) => SomeType
|
|
>x : number
|
|
|
|
return {x: ""+x};
|
|
>{x: ""+x} : { x: string; }
|
|
>x : string
|
|
>""+x : string
|
|
>"" : ""
|
|
>x : number
|
|
}
|
|
class ExportedThing {
|
|
>ExportedThing : ExportedThing
|
|
|
|
z = "ok"
|
|
>z : string
|
|
>"ok" : "ok"
|
|
}
|
|
module.exports = {
|
|
>module.exports = { doTheThing, ExportedThing,} : typeof module.exports
|
|
>module.exports : typeof module.exports
|
|
>module : { exports: typeof module.exports; }
|
|
>exports : typeof module.exports
|
|
>{ doTheThing, ExportedThing,} : { doTheThing: (x: number) => SomeType; ExportedThing: typeof ExportedThing; }
|
|
|
|
doTheThing,
|
|
>doTheThing : (x: number) => SomeType
|
|
|
|
ExportedThing,
|
|
>ExportedThing : typeof ExportedThing
|
|
|
|
};
|
|
class LocalThing {
|
|
>LocalThing : LocalThing
|
|
|
|
y = "ok"
|
|
>y : string
|
|
>"ok" : "ok"
|
|
}
|
|
|