File: instantiationExpressions.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (228 lines) | stat: -rw-r--r-- 12,589 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
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressions.ts(6,16): error TS1099: Type argument list cannot be empty.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressions.ts(9,17): error TS2635: Type '{ <T>(x: T): T; <T>(x: T, n: number): T; <T, U>(t: [T, U]): [T, U]; }' has no signatures for which the type argument list is applicable.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressions.ts(12,21): error TS1099: Type argument list cannot be empty.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressions.ts(15,22): error TS2635: Type '{ <T>(x: T): T; <T>(x: T, n: number): T; <T, U>(t: [T, U]): [T, U]; }' has no signatures for which the type argument list is applicable.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressions.ts(18,21): error TS1099: Type argument list cannot be empty.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressions.ts(20,22): error TS2635: Type 'ArrayConstructor' has no signatures for which the type argument list is applicable.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressions.ts(23,24): error TS1099: Type argument list cannot be empty.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressions.ts(25,25): error TS2635: Type 'ArrayConstructor' has no signatures for which the type argument list is applicable.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressions.ts(50,16): error TS2635: Type '{ x: string; y: string; }' has no signatures for which the type argument list is applicable.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressions.ts(82,16): error TS2635: Type '{ x: string; } & { y: string; }' has no signatures for which the type argument list is applicable.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressions.ts(106,16): error TS2635: Type '(a: string, b: number) => string[]' has no signatures for which the type argument list is applicable.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressions.ts(114,16): error TS2635: Type '{ x: string; } | { y: string; }' has no signatures for which the type argument list is applicable.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressions.ts(126,16): error TS2635: Type '(a: string, b: number) => string[]' has no signatures for which the type argument list is applicable.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressions.ts(130,16): error TS2635: Type 'new (a: string, b: number) => string[]' has no signatures for which the type argument list is applicable.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressions.ts(163,40): error TS2344: Type 'U' does not satisfy the constraint 'number'.
  Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressions.ts(164,40): error TS2344: Type 'U' does not satisfy the constraint 'string'.
  Type 'number' is not assignable to type 'string'.


==== tests/cases/conformance/types/typeParameters/typeArgumentLists/instantiationExpressions.ts (16 errors) ====
    declare function fx<T>(x: T): T;
    declare function fx<T>(x: T, n: number): T;
    declare function fx<T, U>(t: [T, U]): [T, U];
    
    function f1() {
        let f0 = fx<>;  // Error
                   ~~
!!! error TS1099: Type argument list cannot be empty.
        let f1 = fx<string>;  // { (x: string): string; (x: string, n: number): string; }
        let f2 = fx<string, number>;  // (t: [string, number]) => [string, number]
        let f3 = fx<string, number, boolean>;  // Error
                    ~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2635: Type '{ <T>(x: T): T; <T>(x: T, n: number): T; <T, U>(t: [T, U]): [T, U]; }' has no signatures for which the type argument list is applicable.
    }
    
    type T10 = typeof fx<>;  // Error
                        ~~
!!! error TS1099: Type argument list cannot be empty.
    type T11 = typeof fx<string>;  // { (x: string): string; (x: string, n: number): string; }
    type T12 = typeof fx<string, number>;  // (t: [string, number]) => [string, number]
    type T13 = typeof fx<string, number, boolean>;  // Error
                         ~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2635: Type '{ <T>(x: T): T; <T>(x: T, n: number): T; <T, U>(t: [T, U]): [T, U]; }' has no signatures for which the type argument list is applicable.
    
    function f2() {
        const A0 = Array<>;  // Error
                        ~~
!!! error TS1099: Type argument list cannot be empty.
        const A1 = Array<string>;  // new (...) => string[]
        const A2 = Array<string, number>;  // Error
                         ~~~~~~~~~~~~~~
!!! error TS2635: Type 'ArrayConstructor' has no signatures for which the type argument list is applicable.
    }
    
    type T20 = typeof Array<>;  // Error
                           ~~
!!! error TS1099: Type argument list cannot be empty.
    type T21 = typeof Array<string>;  // new (...) => string[]
    type T22 = typeof Array<string, number>;  // Error
                            ~~~~~~~~~~~~~~
!!! error TS2635: Type 'ArrayConstructor' has no signatures for which the type argument list is applicable.
    
    declare class C<T> {
        constructor(x: T);
        static f<U>(x: U): U[];
    }
    
    function f3() {
        let c1 = C<string>;  // { new (x: string): C<string>; f<U>(x: U): T[]; prototype: C<any>; }
        let f1 = C.f<string>;  // (x: string) => string[]
    }
    
    function f10(f: { <T>(a: T): T, <U>(a: U, b: number): U[] }) {
        let fs = f<string>;  // { (a: string): string; (a: string, b: number): string[]; }
    }
    
    function f11(f: { <T>(a: T): T, (a: string, b: number): string[] }) {
        let fs = f<string>;  // (a: string) => string
    }
    
    function f12(f: { <T>(a: T): T, x: string }) {
        let fs = f<string>;  // { (a: string): string; x: string; }
    }
    
    function f13(f: { x: string, y: string }) {
        let fs = f<string>;  // Error, no applicable signatures
                   ~~~~~~
!!! error TS2635: Type '{ x: string; y: string; }' has no signatures for which the type argument list is applicable.
    }
    
    function f14(f: { new <T>(a: T): T, new <U>(a: U, b: number): U[] }) {
        let fs = f<string>;  // { new (a: string): string; new (a: string, b: number): string[]; }
    }
    
    function f15(f: { new <T>(a: T): T, <U>(a: U, b: number): U[] }) {
        let fs = f<string>;  // { new (a: string): string; (a: string, b: number): string[]; }
    }
    
    function f16(f: { new <T>(a: T): T, (a: string, b: number): string[] }) {
        let fs = f<string>;  // new (a: string) => string
    }
    
    function f17(f: { <T>(a: T): T, new (a: string, b: number): string[] }) {
        let fs = f<string>;  // (a: string) => string
    }
    
    function f20(f: (<T>(a: T) => T) & (<U>(a: U, b: number) => U[])) {
        let fs = f<string>;  // ((a: string) => string) & ((a: string, b: number) => string[]])
    }
    
    function f21(f: (<T>(a: T) => T) & ((a: string, b: number) => string[])) {
        let fs = f<string>;  // (a: string) => string
    }
    
    function f22(f: (<T>(a: T) => T) & { x: string }) {
        let fs = f<string>;  // ((a: string) => string) & { x: string }
    }
    
    function f23(f: { x: string } & { y: string }) {
        let fs = f<string>;  // Error, no applicable signatures
                   ~~~~~~
!!! error TS2635: Type '{ x: string; } & { y: string; }' has no signatures for which the type argument list is applicable.
    }
    
    function f24(f: (new <T>(a: T) => T) & (new <U>(a: U, b: number) => U[])) {
        let fs = f<string>;  // (new (a: string) => string) & ((a: string, b: number) => string[]])
    }
    
    function f25(f: (new <T>(a: T) => T) & (<U>(a: U, b: number) => U[])) {
        let fs = f<string>;  // (new (a: string) => string) & ((a: string, b: number) => string[]])
    }
    
    function f26(f: (new <T>(a: T) => T) & ((a: string, b: number) => string[])) {
        let fs = f<string>;  // new (a: string) => string
    }
    
    function f27(f: (<T>(a: T) => T) & (new (a: string, b: number) => string[])) {
        let fs = f<string>;  // (a: string) => string
    }
    
    function f30(f: (<T>(a: T) => T) | (<U>(a: U, b: number) => U[])) {
        let fs = f<string>;  // ((a: string) => string) | ((a: string, b: number) => string[]])
    }
    
    function f31(f: (<T>(a: T) => T) | ((a: string, b: number) => string[])) {
        let fs = f<string>;  // Error, '(a: string, b: number) => string[]' has no applicable signatures
                   ~~~~~~
!!! error TS2635: Type '(a: string, b: number) => string[]' has no signatures for which the type argument list is applicable.
    }
    
    function f32(f: (<T>(a: T) => T) | { x: string }) {
        let fs = f<string>;  // ((a: string) => string) | { x: string }
    }
    
    function f33(f: { x: string } | { y: string }) {
        let fs = f<string>;  // Error, no applicable signatures
                   ~~~~~~
!!! error TS2635: Type '{ x: string; } | { y: string; }' has no signatures for which the type argument list is applicable.
    }
    
    function f34(f: (new <T>(a: T) => T) | (new <U>(a: U, b: number) => U[])) {
        let fs = f<string>;  // (new (a: string) => string) | ((a: string, b: number) => string[]])
    }
    
    function f35(f: (new <T>(a: T) => T) | (<U>(a: U, b: number) => U[])) {
        let fs = f<string>;  // (new (a: string) => string) | ((a: string, b: number) => string[]])
    }
    
    function f36(f: (new <T>(a: T) => T) | ((a: string, b: number) => string[])) {
        let fs = f<string>;  // Error, '(a: string, b: number) => string[]' has no applicable signatures
                   ~~~~~~
!!! error TS2635: Type '(a: string, b: number) => string[]' has no signatures for which the type argument list is applicable.
    }
    
    function f37(f: (<T>(a: T) => T) | (new (a: string, b: number) => string[])) {
        let fs = f<string>;  // Error, 'new (a: string, b: number) => string[]' has no applicable signatures
                   ~~~~~~
!!! error TS2635: Type 'new (a: string, b: number) => string[]' has no signatures for which the type argument list is applicable.
    }
    
    function f38<T extends (<A>(x: A) => A) | (<B>(x: B) => B[]), U>(f: T | U | (<C>(x: C) => C[][])) {
        let fs = f<string>;  // U | ((x: string) => string) | ((x: string) => string[]) | ((x: string) => string[][])
    }
    
    function makeBox<T>(value: T) {
        return { value };
    }
    
    type BoxFunc<T> = typeof makeBox<T>;  // (value: T) => { value: T }
    type StringBoxFunc = BoxFunc<string>;  // (value: string) => { value: string }
    
    type Box<T> = ReturnType<typeof makeBox<T>>;  // { value: T }
    type StringBox = Box<string>;  // { value: string }
    
    type A<U> = InstanceType<typeof Array<U>>;  // U[]
    
    declare const g1: {
        <T>(a: T): { a: T };
        new <U>(b: U): { b: U };
    }
    
    type T30<V> = typeof g1<V>;  // { (a: V) => { a: V }; new (b: V) => { b: V }; }
    type T31<A> = ReturnType<T30<A>>;  // { a: A }
    type T32<B> = InstanceType<T30<B>>;  // { b: B }
    
    declare const g2: {
        <T extends string>(a: T): T;
        new <T extends number>(b: T): T;
    }
    
    type T40<U extends string> = typeof g2<U>;  // Error
                                           ~
!!! error TS2344: Type 'U' does not satisfy the constraint 'number'.
!!! error TS2344:   Type 'string' is not assignable to type 'number'.
    type T41<U extends number> = typeof g2<U>;  // Error
                                           ~
!!! error TS2344: Type 'U' does not satisfy the constraint 'string'.
!!! error TS2344:   Type 'number' is not assignable to type 'string'.
    
    declare const g3: {
        <T extends string>(a: T): T;
        new <T extends number, Q>(b: T): T;
    }
    
    type T50<U extends string> = typeof g3<U>;  // (a: U) => U
    type T51<U extends number> = typeof g3<U, any>;  // (b: U) => U