File: thisTypeOfConstructorFunctions.types

package info (click to toggle)
node-typescript 5.0.4%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 459,116 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (137 lines) | stat: -rw-r--r-- 2,464 bytes parent folder | download | duplicates (4)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
=== tests/cases/conformance/salsa/thisTypeOfConstructorFunctions.js ===
/**
 * @class
 * @template T
 * @param {T} t
 */
function Cp(t) {
>Cp : typeof Cp
>t : T

    /** @type {this} */
    this.dit = this
>this.dit = this : this
>this.dit : this
>this : this
>dit : this
>this : this

    this.y = t
>this.y = t : T
>this.y : any
>this : this
>y : any
>t : T

    /** @return {this} */
    this.m3 = () => this
>this.m3 = () => this : () => this
>this.m3 : any
>this : this
>m3 : any
>() => this : () => this
>this : this
}

Cp.prototype = {
>Cp.prototype = {    /** @return {this} */    m4() {        this.z = this.y; return this    }} : { m4(): this; }
>Cp.prototype : { m4(): this; }
>Cp : typeof Cp
>prototype : { m4(): this; }
>{    /** @return {this} */    m4() {        this.z = this.y; return this    }} : { m4(): this; }

    /** @return {this} */
    m4() {
>m4 : () => this

        this.z = this.y; return this
>this.z = this.y : T
>this.z : T
>this : this
>z : T
>this.y : T
>this : this
>y : T
>this : this
    }
}

/**
 * @class
 * @template T
 * @param {T} t
 */
function Cpp(t) {
>Cpp : typeof Cpp
>t : T

    this.y = t
>this.y = t : T
>this.y : any
>this : this
>y : any
>t : T
}
/** @return {this} */
Cpp.prototype.m2 = function () {
>Cpp.prototype.m2 = function () {    this.z = this.y; return this} : () => this
>Cpp.prototype.m2 : any
>Cpp.prototype : any
>Cpp : typeof Cpp
>prototype : any
>m2 : any
>function () {    this.z = this.y; return this} : () => this

    this.z = this.y; return this
>this.z = this.y : T
>this.z : T
>this : this
>z : T
>this.y : T
>this : this
>y : T
>this : this
}

var cp = new Cp(1)
>cp : Cp<number>
>new Cp(1) : Cp<number>
>Cp : typeof Cp
>1 : 1

var cpp = new Cpp(2)
>cpp : Cpp<number>
>new Cpp(2) : Cpp<number>
>Cpp : typeof Cpp
>2 : 2

cp.dit
>cp.dit : Cp<number>
>cp : Cp<number>
>dit : Cp<number>

/** @type {Cpp<number>} */
var cppn = cpp.m2()
>cppn : Cpp<number>
>cpp.m2() : Cpp<number>
>cpp.m2 : () => Cpp<number>
>cpp : Cpp<number>
>m2 : () => Cpp<number>

/** @type {Cp<number>} */
var cpn = cp.m3()
>cpn : Cp<number>
>cp.m3() : Cp<number>
>cp.m3 : () => Cp<number>
>cp : Cp<number>
>m3 : () => Cp<number>

/** @type {Cp<number>} */
var cpn = cp.m4()
>cpn : Cp<number>
>cp.m4() : Cp<number>
>cp.m4 : () => Cp<number>
>cp : Cp<number>
>m4 : () => Cp<number>