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
48 lines
976 B
Plaintext
48 lines
976 B
Plaintext
=== tests/cases/conformance/jsdoc/mod1.js ===
|
|
/** @callback Con - some kind of continuation
|
|
* @param {object | undefined} error
|
|
* @return {any} I don't even know what this should return
|
|
*/
|
|
module.exports = C
|
|
>module.exports = C : typeof C
|
|
>module.exports : typeof C
|
|
>module : { exports: typeof C; }
|
|
>exports : typeof C
|
|
>C : typeof C
|
|
|
|
function C() {
|
|
>C : typeof C
|
|
|
|
this.p = 1
|
|
>this.p = 1 : 1
|
|
>this.p : any
|
|
>this : this
|
|
>p : any
|
|
>1 : 1
|
|
}
|
|
|
|
=== tests/cases/conformance/jsdoc/use.js ===
|
|
/** @param {import('./mod1').Con} k */
|
|
function f(k) {
|
|
>f : (k: import('./mod1').Con) => any
|
|
>k : import("tests/cases/conformance/jsdoc/mod1").Con
|
|
|
|
if (1 === 2 - 1) {
|
|
>1 === 2 - 1 : boolean
|
|
>1 : 1
|
|
>2 - 1 : number
|
|
>2 : 2
|
|
>1 : 1
|
|
|
|
// I guess basic math works!
|
|
}
|
|
return k({ ok: true})
|
|
>k({ ok: true}) : any
|
|
>k : import("tests/cases/conformance/jsdoc/mod1").Con
|
|
>{ ok: true} : { ok: boolean; }
|
|
>ok : boolean
|
|
>true : true
|
|
}
|
|
|
|
|