File: jsdocTemplateConstructorFunction2.types

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (86 lines) | stat: -rw-r--r-- 1,542 bytes parent folder | download
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
79
80
81
82
83
84
85
86
=== tests/cases/conformance/jsdoc/templateTagWithNestedTypeLiteral.js ===
/**
 * @param {T} t
 * @template T
 */
function Zet(t) {
>Zet : typeof Zet
>t : T

    /** @type {T} */
    this.u
>this.u : any
>this : any
>u : any

    this.t = t
>this.t = t : T
>this.t : any
>this : any
>t : any
>t : T
}
/**
 * @param {T} v
 * @param {object} o
 * @param {T} o.nested
 */
Zet.prototype.add = function(v, o) {
>Zet.prototype.add = function(v, o) {    this.u = v || o.nested    return this.u} : (v: T, o: { nested: T; }) => T
>Zet.prototype.add : any
>Zet.prototype : any
>Zet : typeof Zet
>prototype : any
>add : any
>function(v, o) {    this.u = v || o.nested    return this.u} : (v: T, o: { nested: T; }) => T
>v : T
>o : { nested: T; }

    this.u = v || o.nested
>this.u = v || o.nested : T
>this.u : T
>this : Zet
>u : T
>v || o.nested : T
>v : T
>o.nested : T
>o : { nested: T; }
>nested : T

    return this.u
>this.u : T
>this : Zet
>u : T
}
var z = new Zet(1)
>z : typeof Zet
>new Zet(1) : typeof Zet
>Zet : typeof Zet
>1 : 1

z.t = 2
>z.t = 2 : 2
>z.t : number
>z : typeof Zet
>t : number
>2 : 2

z.u = false
>z.u = false : false
>z.u : number
>z : typeof Zet
>u : number
>false : false

// 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 : A
>{ value: null } : { value: null; }
>value : null
>null : null