File: propertyAccessOnTypeParameterWithConstraints4.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 (127 lines) | stat: -rw-r--r-- 2,538 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
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
=== tests/cases/conformance/types/typeParameters/typeParameterLists/propertyAccessOnTypeParameterWithConstraints4.ts ===
class C<T extends Date> {
>C : C<T>

    f() {
>f : () => any

        var x: T;
>x : T

        var a = x['notHere'](); // should be string
>a : any
>x['notHere']() : any
>x['notHere'] : any
>x : T
>'notHere' : "notHere"

        return a + x.notHere();
>a + x.notHere() : any
>a : any
>x.notHere() : any
>x.notHere : any
>x : T
>notHere : any
    }
}

var r = (new C<Date>()).f();
>r : any
>(new C<Date>()).f() : any
>(new C<Date>()).f : () => any
>(new C<Date>()) : C<Date>
>new C<Date>() : C<Date>
>C : typeof C
>f : () => any

interface I<T extends Date> {
    foo: T;
>foo : T
}
var i: I<Date>;
>i : I<Date>

var r2 = i.foo.notHere();
>r2 : any
>i.foo.notHere() : any
>i.foo.notHere : any
>i.foo : Date
>i : I<Date>
>foo : Date
>notHere : any

var r2b = i.foo['notHere']();
>r2b : any
>i.foo['notHere']() : any
>i.foo['notHere'] : any
>i.foo : Date
>i : I<Date>
>foo : Date
>'notHere' : "notHere"

var a: {
>a : <T extends Date>() => T

    <T extends Date>(): T;
}
var r3: string = a().notHere();
>r3 : string
>a().notHere() : any
>a().notHere : any
>a() : Date
>a : <T extends Date>() => T
>notHere : any

var r3b: string = a()['notHere']();
>r3b : string
>a()['notHere']() : any
>a()['notHere'] : any
>a() : Date
>a : <T extends Date>() => T
>'notHere' : "notHere"

var b = {
>b : any
>{    foo: <T extends Date>(x: T): T => {        var a = x['notHere'](); // should be string        return a + x.notHere();    },    bar: b.foo().notHere()} : { foo: <T extends Date>(x: T) => T; bar: any; }

    foo: <T extends Date>(x: T): T => {
>foo : <T extends Date>(x: T) => T
><T extends Date>(x: T): T => {        var a = x['notHere'](); // should be string        return a + x.notHere();    } : <T extends Date>(x: T) => T
>x : T

        var a = x['notHere'](); // should be string
>a : any
>x['notHere']() : any
>x['notHere'] : any
>x : T
>'notHere' : "notHere"

        return a + x.notHere();
>a + x.notHere() : any
>a : any
>x.notHere() : any
>x.notHere : any
>x : T
>notHere : any

    },
    bar: b.foo().notHere()
>bar : any
>b.foo().notHere() : any
>b.foo().notHere : any
>b.foo() : any
>b.foo : any
>b : any
>foo : any
>notHere : any
}

var r4 = b.foo(new Date());
>r4 : any
>b.foo(new Date()) : any
>b.foo : any
>b : any
>foo : any
>new Date() : Date
>Date : DateConstructor