File: objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.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 (204 lines) | stat: -rw-r--r-- 7,696 bytes parent folder | download
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.ts ===
// object types are identical structurally

class B<U, V> {
>B : B<U, V>

    constructor(x: U) { return null; }
>x : U
>null : null
}

class C<V, W, X> {
>C : C<V, W, X>

    constructor(x: V) { return null; }
>x : V
>null : null
}

interface I<X, Y, Z, A> {
    new(x: X): B<X,Y>;
>x : X
}

interface I2 {
    new <Y, Z, A, B>(x: Y): C<Y, Z, A>;
>x : Y
}

var a: { new <Z, A, B, CC, D>(x: Z): C<Z, A, B>; }
>a : new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>
>x : Z

var b = { new<A, B, C, D, E, F>(x: A) { return x; } };
>b : { new<A, B, C, D, E, F>(x: A): A; }
>{ new<A, B, C, D, E, F>(x: A) { return x; } } : { new<A, B, C, D, E, F>(x: A): A; }
>new : <A, B, C, D, E, F>(x: A) => A
>x : A
>x : A

function foo1b(x: B<string, string>);
>foo1b : { (x: B<string, string>): any; (x: B<string, string>): any; }
>x : B<string, string>

function foo1b(x: B<string, string>); // error
>foo1b : { (x: B<string, string>): any; (x: B<string, string>): any; }
>x : B<string, string>

function foo1b(x: any) { }
>foo1b : { (x: B<string, string>): any; (x: B<string, string>): any; }
>x : any

function foo1c(x: C<string, number, boolean>);
>foo1c : { (x: C<string, number, boolean>): any; (x: C<string, number, boolean>): any; }
>x : C<string, number, boolean>

function foo1c(x: C<string, number, boolean>); // error
>foo1c : { (x: C<string, number, boolean>): any; (x: C<string, number, boolean>): any; }
>x : C<string, number, boolean>

function foo1c(x: any) { }
>foo1c : { (x: C<string, number, boolean>): any; (x: C<string, number, boolean>): any; }
>x : any

function foo2(x: I<string, boolean, number, string>);
>foo2 : { (x: I<string, boolean, number, string>): any; (x: I<string, boolean, number, string>): any; }
>x : I<string, boolean, number, string>

function foo2(x: I<string, boolean, number, string>); // error
>foo2 : { (x: I<string, boolean, number, string>): any; (x: I<string, boolean, number, string>): any; }
>x : I<string, boolean, number, string>

function foo2(x: any) { }
>foo2 : { (x: I<string, boolean, number, string>): any; (x: I<string, boolean, number, string>): any; }
>x : any

function foo3(x: typeof a);
>foo3 : { (x: new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>): any; (x: new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>): any; }
>x : new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>
>a : new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>

function foo3(x: typeof a); // error
>foo3 : { (x: new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>): any; (x: new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>): any; }
>x : new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>
>a : new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>

function foo3(x: any) { }
>foo3 : { (x: new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>): any; (x: new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>): any; }
>x : any

function foo4(x: typeof b);
>foo4 : { (x: { new<A, B, C, D, E, F>(x: A): A; }): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
>x : { new<A, B, C, D, E, F>(x: A): A; }
>b : { new<A, B, C, D, E, F>(x: A): A; }

function foo4(x: typeof b); // error
>foo4 : { (x: { new<A, B, C, D, E, F>(x: A): A; }): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
>x : { new<A, B, C, D, E, F>(x: A): A; }
>b : { new<A, B, C, D, E, F>(x: A): A; }

function foo4(x: any) { }
>foo4 : { (x: { new<A, B, C, D, E, F>(x: A): A; }): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
>x : any

function foo8(x: B<string, string>);
>foo8 : { (x: B<string, string>): any; (x: I<string, string, boolean, Date>): any; }
>x : B<string, string>

function foo8(x: I<string, string, boolean, Date>); // BUG 832086
>foo8 : { (x: B<string, string>): any; (x: I<string, string, boolean, Date>): any; }
>x : I<string, string, boolean, Date>

function foo8(x: any) { }
>foo8 : { (x: B<string, string>): any; (x: I<string, string, boolean, Date>): any; }
>x : any

function foo9(x: B<string, number>);
>foo9 : { (x: B<string, number>): any; (x: C<string, number, B<string, string>>): any; }
>x : B<string, number>

function foo9(x: C<string, number, B<string, string>>); // error
>foo9 : { (x: B<string, number>): any; (x: C<string, number, B<string, string>>): any; }
>x : C<string, number, B<string, string>>

function foo9(x: any) { }
>foo9 : { (x: B<string, number>): any; (x: C<string, number, B<string, string>>): any; }
>x : any

function foo10(x: B<string, boolean>);
>foo10 : { (x: B<string, boolean>): any; (x: new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>): any; }
>x : B<string, boolean>

function foo10(x: typeof a); // ok
>foo10 : { (x: B<string, boolean>): any; (x: new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>): any; }
>x : new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>
>a : new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>

function foo10(x: any) { }
>foo10 : { (x: B<string, boolean>): any; (x: new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>): any; }
>x : any

function foo11(x: B<string, boolean>);
>foo11 : { (x: B<string, boolean>): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
>x : B<string, boolean>

function foo11(x: typeof b); // ok
>foo11 : { (x: B<string, boolean>): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
>x : { new<A, B, C, D, E, F>(x: A): A; }
>b : { new<A, B, C, D, E, F>(x: A): A; }

function foo11(x: any) { }
>foo11 : { (x: B<string, boolean>): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
>x : any

function foo12(x: I<B<string, number>, number, Date, string>);
>foo12 : { (x: I<B<string, number>, number, Date, string>): any; (x: C<B<string, number>, number, Date>): any; }
>x : I<B<string, number>, number, Date, string>

function foo12(x: C<B<string, number>, number, Date>); // ok
>foo12 : { (x: I<B<string, number>, number, Date, string>): any; (x: C<B<string, number>, number, Date>): any; }
>x : C<B<string, number>, number, Date>

function foo12(x: any) { }
>foo12 : { (x: I<B<string, number>, number, Date, string>): any; (x: C<B<string, number>, number, Date>): any; }
>x : any

function foo12b(x: I2);
>foo12b : { (x: I2): any; (x: C<string, string, boolean>): any; }
>x : I2

function foo12b(x: C<string, string, boolean>); // BUG 832086
>foo12b : { (x: I2): any; (x: C<string, string, boolean>): any; }
>x : C<string, string, boolean>

function foo12b(x: any) { }
>foo12b : { (x: I2): any; (x: C<string, string, boolean>): any; }
>x : any

function foo13(x: I<string, Date, RegExp, Date>);
>foo13 : { (x: I<string, Date, RegExp, Date>): any; (x: new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>): any; }
>x : I<string, Date, RegExp, Date>

function foo13(x: typeof a); // ok
>foo13 : { (x: I<string, Date, RegExp, Date>): any; (x: new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>): any; }
>x : new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>
>a : new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>

function foo13(x: any) { }
>foo13 : { (x: I<string, Date, RegExp, Date>): any; (x: new <Z, A, B, CC, D>(x: Z) => C<Z, A, B>): any; }
>x : any

function foo14(x: I<string, Date, RegExp, boolean>);
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
>x : I<string, Date, RegExp, boolean>

function foo14(x: typeof b); // ok
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
>x : { new<A, B, C, D, E, F>(x: A): A; }
>b : { new<A, B, C, D, E, F>(x: A): A; }

function foo14(x: any) { }
>foo14 : { (x: I<string, Date, RegExp, boolean>): any; (x: { new<A, B, C, D, E, F>(x: A): A; }): any; }
>x : any