1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
=== tests/cases/conformance/jsdoc/use.js ===
var mod = require('./mod1.js');
>mod : { Baz: any; Bar: typeof Bar; Quid: any; } | { Quack: any; Bar: typeof Bar; Quid: any; }
>require('./mod1.js') : { Baz: any; Bar: typeof Bar; Quid: any; } | { Quack: any; Bar: typeof Bar; Quid: any; }
>require : any
>'./mod1.js' : "./mod1.js"
/** @type {import("./mod1.js").Baz} */
var b;
>b : number
/** @type {mod.Baz} */
var bb;
>bb : number
var bbb = new mod.Baz();
>bbb : any
>new mod.Baz() : any
>mod.Baz : any
>mod : { Baz: any; Bar: typeof Bar; Quid: any; } | { Quack: any; Bar: typeof Bar; Quid: any; }
>Baz : any
=== tests/cases/conformance/jsdoc/mod1.js ===
// error
/** @typedef {number} Foo */
class Foo { } // should error
>Foo : Foo
/** @typedef {number} Bar */
exports.Bar = class { }
>exports.Bar = class { } : typeof Bar
>exports.Bar : typeof Bar
>exports : { Baz: any; Bar: typeof Bar; Quid: any; } | { Quack: any; Bar: typeof Bar; Quid: any; }
>Bar : typeof Bar
>class { } : typeof Bar
/** @typedef {number} Baz */
module.exports = {
>module.exports = { Baz: class { }} : { Baz: any; Bar: typeof Bar; Quid: any; } | { Quack: any; Bar: typeof Bar; Quid: any; }
>module.exports : { Baz: any; Bar: typeof Bar; Quid: any; } | { Quack: any; Bar: typeof Bar; Quid: any; }
>module : { "tests/cases/conformance/jsdoc/mod1": { Baz: any; Bar: typeof Bar; Quid: any; } | { Quack: any; Bar: typeof Bar; Quid: any; }; }
>exports : { Baz: any; Bar: typeof Bar; Quid: any; } | { Quack: any; Bar: typeof Bar; Quid: any; }
>{ Baz: class { }} : { Baz: typeof Baz; }
Baz: class { }
>Baz : typeof Baz
>class { } : typeof Baz
}
// ok
/** @typedef {number} Qux */
var Qux = 2;
>Qux : number
>2 : 2
/** @typedef {number} Quid */
exports.Quid = 2;
>exports.Quid = 2 : 2
>exports.Quid : any
>exports : { Baz: any; Bar: typeof Bar; Quid: any; } | { Quack: any; Bar: typeof Bar; Quid: any; }
>Quid : any
>2 : 2
/** @typedef {number} Quack */
module.exports = {
>module.exports = { Quack: 2} : { Baz: any; Bar: typeof Bar; Quid: any; } | { Quack: any; Bar: typeof Bar; Quid: any; }
>module.exports : { Baz: any; Bar: typeof Bar; Quid: any; } | { Quack: any; Bar: typeof Bar; Quid: any; }
>module : { "tests/cases/conformance/jsdoc/mod1": { Baz: any; Bar: typeof Bar; Quid: any; } | { Quack: any; Bar: typeof Bar; Quid: any; }; }
>exports : { Baz: any; Bar: typeof Bar; Quid: any; } | { Quack: any; Bar: typeof Bar; Quid: any; }
>{ Quack: 2} : { Quack: number; }
Quack: 2
>Quack : number
>2 : 2
}
|