File: genericSetterInClassTypeJsDoc.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 (51 lines) | stat: -rw-r--r-- 848 bytes parent folder | download | duplicates (3)
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
=== tests/cases/conformance/classes/members/classTypes/genericSetterInClassTypeJsDoc.js ===
/**
 * @template T
 */
 class Box {
>Box : Box<T>

    #value;
>#value : T

    /** @param {T} initialValue */
    constructor(initialValue) {
>initialValue : T

        this.#value = initialValue;
>this.#value = initialValue : T
>this.#value : T
>this : this
>initialValue : T
    }
    
    /** @type {T} */
    get value() {
>value : T

        return this.#value;
>this.#value : T
>this : this
    }

    set value(value) {
>value : T
>value : T

        this.#value = value;
>this.#value = value : T
>this.#value : T
>this : this
>value : T
    }
}

new Box(3).value = 3;
>new Box(3).value = 3 : 3
>new Box(3).value : number
>new Box(3) : Box<number>
>Box : typeof Box
>3 : 3
>value : number
>3 : 3