File: subtypingWithCallSignaturesWithRestParameters.errors.txt

package info (click to toggle)
node-typescript 2.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 203,952 kB
  • ctags: 52,987
  • sloc: sh: 11; makefile: 5
file content (257 lines) | stat: -rw-r--r-- 14,393 bytes parent folder | download | duplicates (7)
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(18,11): error TS2430: Interface 'I1C' incorrectly extends interface 'Base'.
  Types of property 'a' are incompatible.
    Type '(...args: string[]) => number' is not assignable to type '(...args: number[]) => number'.
      Types of parameters 'args' and 'args' are incompatible.
        Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(34,11): error TS2430: Interface 'I3B' incorrectly extends interface 'Base'.
  Types of property 'a' are incompatible.
    Type '(x?: string) => number' is not assignable to type '(...args: number[]) => number'.
      Types of parameters 'x' and 'args' are incompatible.
        Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(60,11): error TS2430: Interface 'I6C' incorrectly extends interface 'Base'.
  Types of property 'a2' are incompatible.
    Type '(x: number, ...args: string[]) => number' is not assignable to type '(x: number, ...z: number[]) => number'.
      Types of parameters 'args' and 'z' are incompatible.
        Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(90,11): error TS2430: Interface 'I10B' incorrectly extends interface 'Base'.
  Types of property 'a3' are incompatible.
    Type '(x: number, y?: number, z?: number) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
      Types of parameters 'y' and 'y' are incompatible.
        Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(94,11): error TS2430: Interface 'I10C' incorrectly extends interface 'Base'.
  Types of property 'a3' are incompatible.
    Type '(x: number, ...z: number[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
      Types of parameters 'z' and 'y' are incompatible.
        Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(98,11): error TS2430: Interface 'I10D' incorrectly extends interface 'Base'.
  Types of property 'a3' are incompatible.
    Type '(x: string, y?: string, z?: string) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
      Types of parameters 'x' and 'x' are incompatible.
        Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(102,11): error TS2430: Interface 'I10E' incorrectly extends interface 'Base'.
  Types of property 'a3' are incompatible.
    Type '(x: number, ...z: string[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
      Types of parameters 'z' and 'z' are incompatible.
        Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(110,11): error TS2430: Interface 'I12' incorrectly extends interface 'Base'.
  Types of property 'a4' are incompatible.
    Type '(x?: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
      Types of parameters 'y' and 'y' are incompatible.
        Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(118,11): error TS2430: Interface 'I14' incorrectly extends interface 'Base'.
  Types of property 'a4' are incompatible.
    Type '(x: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
      Types of parameters 'y' and 'y' are incompatible.
        Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(126,11): error TS2430: Interface 'I16' incorrectly extends interface 'Base'.
  Types of property 'a4' are incompatible.
    Type '(x: number, ...args: string[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
      Types of parameters 'args' and 'z' are incompatible.
        Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts(130,11): error TS2430: Interface 'I17' incorrectly extends interface 'Base'.
  Types of property 'a4' are incompatible.
    Type '(...args: number[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
      Types of parameters 'args' and 'y' are incompatible.
        Type 'string' is not assignable to type 'number'.


==== tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/subtypingWithCallSignaturesWithRestParameters.ts (11 errors) ====
    // call signatures in derived types must have the same or fewer optional parameters as the base type
    
    interface Base { 
        a: (...args: number[]) => number;
        a2: (x: number, ...z: number[]) => number;
        a3: (x: number, y?: string, ...z: number[]) => number;
        a4: (x?: number, y?: string, ...z: number[]) => number;
    }
    
    interface I1 extends Base {
        a: () => number; // ok, same number of required params
    }
    
    interface I1B extends Base {
        a: (...args: number[]) => number; // ok, same number of required params
    }
    
    interface I1C extends Base {
              ~~~
!!! error TS2430: Interface 'I1C' incorrectly extends interface 'Base'.
!!! error TS2430:   Types of property 'a' are incompatible.
!!! error TS2430:     Type '(...args: string[]) => number' is not assignable to type '(...args: number[]) => number'.
!!! error TS2430:       Types of parameters 'args' and 'args' are incompatible.
!!! error TS2430:         Type 'number' is not assignable to type 'string'.
        a: (...args: string[]) => number; // error, type mismatch
    }
    
    interface I2 extends Base {
        a: (x?: number) => number; // ok, same number of required params
    }
    
    interface I2B extends Base {
        a: (x?: number, y?: number, z?: number) => number; // ok, same number of required params
    }
    
    interface I3 extends Base {
        a: (x: number) => number; // ok, all present params match
    }
    
    interface I3B extends Base {
              ~~~
!!! error TS2430: Interface 'I3B' incorrectly extends interface 'Base'.
!!! error TS2430:   Types of property 'a' are incompatible.
!!! error TS2430:     Type '(x?: string) => number' is not assignable to type '(...args: number[]) => number'.
!!! error TS2430:       Types of parameters 'x' and 'args' are incompatible.
!!! error TS2430:         Type 'number' is not assignable to type 'string'.
        a: (x?: string) => number; // error, incompatible type
    }
    
    
    
    interface I4 extends Base {
        a2: () => number; // ok, fewer required params
    }
    
    interface I4B extends Base {
        a2: (...args: number[]) => number; // ok, fewer required params
    }
    
    interface I5 extends Base {
        a2: (x?: number) => number; // ok, fewer required params
    }
    
    interface I6 extends Base {
        a2: (x: number) => number; // ok, same number of required params
    }
    
    interface I6B extends Base {
        a2: (x: number, ...args: number[]) => number; // ok, same number of required params
    }
    
    interface I6C extends Base {
              ~~~
!!! error TS2430: Interface 'I6C' incorrectly extends interface 'Base'.
!!! error TS2430:   Types of property 'a2' are incompatible.
!!! error TS2430:     Type '(x: number, ...args: string[]) => number' is not assignable to type '(x: number, ...z: number[]) => number'.
!!! error TS2430:       Types of parameters 'args' and 'z' are incompatible.
!!! error TS2430:         Type 'number' is not assignable to type 'string'.
        a2: (x: number, ...args: string[]) => number; // error
    }
    
    interface I6D extends Base {
        a2: (x: number, y: number) => number; // ok, all present params match
    }
    
    interface I6E extends Base {
        a2: (x: number, y?: number) => number; // ok, same number of required params
    }
    
    
    
    interface I7 extends Base {
        a3: () => number; // ok, fewer required params
    }
    
    interface I8 extends Base {
        a3: (x?: number) => number; // ok, fewer required params
    }
    
    interface I9 extends Base {
        a3: (x: number) => number; // ok, same number of required params
    }
    
    interface I10 extends Base {
        a3: (x: number, y: string) => number;  // ok, all present params match
    }
    
    interface I10B extends Base {
              ~~~~
!!! error TS2430: Interface 'I10B' incorrectly extends interface 'Base'.
!!! error TS2430:   Types of property 'a3' are incompatible.
!!! error TS2430:     Type '(x: number, y?: number, z?: number) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
!!! error TS2430:       Types of parameters 'y' and 'y' are incompatible.
!!! error TS2430:         Type 'string' is not assignable to type 'number'.
        a3: (x: number, y?: number, z?: number) => number;  // error
    }
    
    interface I10C extends Base {
              ~~~~
!!! error TS2430: Interface 'I10C' incorrectly extends interface 'Base'.
!!! error TS2430:   Types of property 'a3' are incompatible.
!!! error TS2430:     Type '(x: number, ...z: number[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
!!! error TS2430:       Types of parameters 'z' and 'y' are incompatible.
!!! error TS2430:         Type 'string' is not assignable to type 'number'.
        a3: (x: number, ...z: number[]) => number;  // error
    }
    
    interface I10D extends Base {
              ~~~~
!!! error TS2430: Interface 'I10D' incorrectly extends interface 'Base'.
!!! error TS2430:   Types of property 'a3' are incompatible.
!!! error TS2430:     Type '(x: string, y?: string, z?: string) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
!!! error TS2430:       Types of parameters 'x' and 'x' are incompatible.
!!! error TS2430:         Type 'number' is not assignable to type 'string'.
        a3: (x: string, y?: string, z?: string) => number;  // error, incompatible types
    }
    
    interface I10E extends Base {
              ~~~~
!!! error TS2430: Interface 'I10E' incorrectly extends interface 'Base'.
!!! error TS2430:   Types of property 'a3' are incompatible.
!!! error TS2430:     Type '(x: number, ...z: string[]) => number' is not assignable to type '(x: number, y?: string, ...z: number[]) => number'.
!!! error TS2430:       Types of parameters 'z' and 'z' are incompatible.
!!! error TS2430:         Type 'number' is not assignable to type 'string'.
        a3: (x: number, ...z: string[]) => number;  // error
    }
    
    interface I11 extends Base {
        a4: () => number; // ok, fewer required params
    }
    
    interface I12 extends Base {
              ~~~
!!! error TS2430: Interface 'I12' incorrectly extends interface 'Base'.
!!! error TS2430:   Types of property 'a4' are incompatible.
!!! error TS2430:     Type '(x?: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
!!! error TS2430:       Types of parameters 'y' and 'y' are incompatible.
!!! error TS2430:         Type 'string' is not assignable to type 'number'.
        a4: (x?: number, y?: number) => number; // error, type mismatch
    }
    
    interface I13 extends Base {
        a4: (x: number) => number; // ok, all present params match
    }
    
    interface I14 extends Base {
              ~~~
!!! error TS2430: Interface 'I14' incorrectly extends interface 'Base'.
!!! error TS2430:   Types of property 'a4' are incompatible.
!!! error TS2430:     Type '(x: number, y?: number) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
!!! error TS2430:       Types of parameters 'y' and 'y' are incompatible.
!!! error TS2430:         Type 'string' is not assignable to type 'number'.
        a4: (x: number, y?: number) => number;  // error, second param has type mismatch
    }
    
    interface I15 extends Base {
        a4: (x?: number, y?: string) => number;  // ok, same number of required params with matching types
    }
    
    interface I16 extends Base {
              ~~~
!!! error TS2430: Interface 'I16' incorrectly extends interface 'Base'.
!!! error TS2430:   Types of property 'a4' are incompatible.
!!! error TS2430:     Type '(x: number, ...args: string[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
!!! error TS2430:       Types of parameters 'args' and 'z' are incompatible.
!!! error TS2430:         Type 'number' is not assignable to type 'string'.
        a4: (x: number, ...args: string[]) => number;  // error, rest param has type mismatch
    }
    
    interface I17 extends Base {
              ~~~
!!! error TS2430: Interface 'I17' incorrectly extends interface 'Base'.
!!! error TS2430:   Types of property 'a4' are incompatible.
!!! error TS2430:     Type '(...args: number[]) => number' is not assignable to type '(x?: number, y?: string, ...z: number[]) => number'.
!!! error TS2430:       Types of parameters 'args' and 'y' are incompatible.
!!! error TS2430:         Type 'string' is not assignable to type 'number'.
        a4: (...args: number[]) => number; // error
    }