File: genericClassExpressionInFunction.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 (99 lines) | stat: -rw-r--r-- 1,930 bytes parent folder | download | duplicates (5)
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
=== tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts ===
class A<T> {
>A : A<T>

    genericVar: T
>genericVar : T
}
function B1<U>() {
>B1 : <U>() => typeof (Anonymous class)

    // class expression can use T
    return class extends A<U> { }
>class extends A<U> { } : typeof (Anonymous class)
>A : A<U>
}
class B2<V> {
>B2 : B2<V>

    anon = class extends A<V> { }
>anon : typeof (Anonymous class)
>class extends A<V> { } : typeof (Anonymous class)
>A : A<V>
}
function B3<W>() {
>B3 : <W>() => typeof Inner

    return class Inner<TInner> extends A<W> { }
>class Inner<TInner> extends A<W> { } : typeof Inner
>Inner : typeof Inner
>A : A<W>
}
// extends can call B
class K extends B1<number>() {
>K : K
>B1<number>() : B1<number>.(Anonymous class)
>B1 : <U>() => typeof (Anonymous class)

    namae: string;
>namae : string
}
class C extends (new B2<number>().anon) {
>C : C
>(new B2<number>().anon) : B2<number>.(Anonymous class)
>new B2<number>().anon : typeof (Anonymous class)
>new B2<number>() : B2<number>
>B2 : typeof B2
>anon : typeof (Anonymous class)

    name: string;
>name : string
}
let b3Number = B3<number>();
>b3Number : typeof Inner
>B3<number>() : typeof Inner
>B3 : <W>() => typeof Inner

class S extends b3Number<string> {
>S : S
>b3Number : B3<number>.Inner<string>

    nom: string;
>nom : string
}
var c = new C();
>c : C
>new C() : C
>C : typeof C

var k = new K();
>k : K
>new K() : K
>K : typeof K

var s = new S();
>s : S
>new S() : S
>S : typeof S

c.genericVar = 12;
>c.genericVar = 12 : 12
>c.genericVar : number
>c : C
>genericVar : number
>12 : 12

k.genericVar = 12;
>k.genericVar = 12 : 12
>k.genericVar : number
>k : K
>genericVar : number
>12 : 12

s.genericVar = 12;
>s.genericVar = 12 : 12
>s.genericVar : number
>s : S
>genericVar : number
>12 : 12