File: staticPropertyNotInClassType.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 (134 lines) | stat: -rw-r--r-- 2,155 bytes parent folder | download | duplicates (2)
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
=== tests/cases/conformance/classes/members/classTypes/staticPropertyNotInClassType.ts ===
module NonGeneric {
>NonGeneric : typeof NonGeneric

    class C {
>C : C

        fn() { return this; }
>fn : () => this
>this : this

        static get x() { return 1; }
>x : number
>1 : 1

        static set x(v) { }
>x : number
>v : number

        constructor(public a: number, private b: number) { }
>a : number
>b : number

        static foo: string; // not reflected in class type
>foo : string
    }

    module C {
>C : typeof C

        export var bar = ''; // not reflected in class type
>bar : string
>'' : ""
    }

    var c = new C(1, 2);
>c : C
>new C(1, 2) : C
>C : typeof C
>1 : 1
>2 : 2

    var r = c.fn();
>r : C
>c.fn() : C
>c.fn : () => C
>c : C
>fn : () => C

    var r4 = c.foo; // error
>r4 : any
>c.foo : any
>c : C
>foo : any

    var r5 = c.bar; // error
>r5 : any
>c.bar : any
>c : C
>bar : any

    var r6 = c.x; // error
>r6 : any
>c.x : any
>c : C
>x : any
}

module Generic {
>Generic : typeof Generic

    class C<T, U> {
>C : C<T, U>

        fn() { return this; }
>fn : () => this
>this : this

        static get x() { return 1; }
>x : number
>1 : 1

        static set x(v) { }
>x : number
>v : number

        constructor(public a: T, private b: U) { }
>a : T
>b : U

        static foo: T; // not reflected in class type
>foo : any
    }

    module C {
>C : typeof C

        export var bar = ''; // not reflected in class type
>bar : string
>'' : ""
    }

    var c = new C(1, '');
>c : C<number, string>
>new C(1, '') : C<number, string>
>C : typeof C
>1 : 1
>'' : ""

    var r = c.fn();
>r : C<number, string>
>c.fn() : C<number, string>
>c.fn : () => C<number, string>
>c : C<number, string>
>fn : () => C<number, string>

    var r4 = c.foo; // error
>r4 : any
>c.foo : any
>c : C<number, string>
>foo : any

    var r5 = c.bar; // error
>r5 : any
>c.bar : any
>c : C<number, string>
>bar : any

    var r6 = c.x; // error
>r6 : any
>c.x : any
>c : C<number, string>
>x : any
}