mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
63 lines
2.1 KiB
Plaintext
63 lines
2.1 KiB
Plaintext
//// [tests/cases/conformance/jsdoc/jsdocTemplateConstructorFunction2.ts] ////
|
|
|
|
=== templateTagWithNestedTypeLiteral.js ===
|
|
/**
|
|
* @param {T} t
|
|
* @template T
|
|
*/
|
|
function Zet(t) {
|
|
>Zet : Symbol(Zet, Decl(templateTagWithNestedTypeLiteral.js, 0, 0))
|
|
>t : Symbol(t, Decl(templateTagWithNestedTypeLiteral.js, 4, 13))
|
|
|
|
/** @type {T} */
|
|
this.u
|
|
this.t = t
|
|
>t : Symbol(t, Decl(templateTagWithNestedTypeLiteral.js, 4, 13))
|
|
}
|
|
/**
|
|
* @param {T} v
|
|
* @param {object} o
|
|
* @param {T} o.nested
|
|
*/
|
|
Zet.prototype.add = function(v, o) {
|
|
>Zet.prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --))
|
|
>Zet : Symbol(Zet, Decl(templateTagWithNestedTypeLiteral.js, 0, 0))
|
|
>prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --))
|
|
>v : Symbol(v, Decl(templateTagWithNestedTypeLiteral.js, 14, 29))
|
|
>o : Symbol(o, Decl(templateTagWithNestedTypeLiteral.js, 14, 31))
|
|
|
|
this.u = v || o.nested
|
|
>v : Symbol(v, Decl(templateTagWithNestedTypeLiteral.js, 14, 29))
|
|
>o.nested : Symbol(nested, Decl(templateTagWithNestedTypeLiteral.js, 12, 3))
|
|
>o : Symbol(o, Decl(templateTagWithNestedTypeLiteral.js, 14, 31))
|
|
>nested : Symbol(nested, Decl(templateTagWithNestedTypeLiteral.js, 12, 3))
|
|
|
|
return this.u
|
|
}
|
|
var z = new Zet(1)
|
|
>z : Symbol(z, Decl(templateTagWithNestedTypeLiteral.js, 18, 3))
|
|
>Zet : Symbol(Zet, Decl(templateTagWithNestedTypeLiteral.js, 0, 0))
|
|
|
|
z.t = 2
|
|
>z : Symbol(z, Decl(templateTagWithNestedTypeLiteral.js, 18, 3))
|
|
|
|
z.u = false
|
|
>z : Symbol(z, Decl(templateTagWithNestedTypeLiteral.js, 18, 3))
|
|
|
|
/** @type {number} */
|
|
let answer = z.add(3, { nested: 4 })
|
|
>answer : Symbol(answer, Decl(templateTagWithNestedTypeLiteral.js, 22, 3))
|
|
>z : Symbol(z, Decl(templateTagWithNestedTypeLiteral.js, 18, 3))
|
|
>nested : Symbol(nested, Decl(templateTagWithNestedTypeLiteral.js, 22, 23))
|
|
|
|
// lookup in typedef should not crash the compiler, even when the type is unknown
|
|
/**
|
|
* @typedef {Object} A
|
|
* @property {T} value
|
|
*/
|
|
/** @type {A} */
|
|
const options = { value: null };
|
|
>options : Symbol(options, Decl(templateTagWithNestedTypeLiteral.js, 30, 5))
|
|
>value : Symbol(value, Decl(templateTagWithNestedTypeLiteral.js, 30, 17))
|
|
|