File: destructuringTuple.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 (46 lines) | stat: -rw-r--r-- 3,236 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
tests/cases/compiler/destructuringTuple.ts(11,7): error TS2461: Type 'number' is not an array type.
tests/cases/compiler/destructuringTuple.ts(11,48): error TS2769: No overload matches this call.
  Overload 1 of 3, '(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number', gave the following error.
    Type 'never[]' is not assignable to type 'number'.
  Overload 2 of 3, '(callbackfn: (previousValue: [], currentValue: number, currentIndex: number, array: number[]) => [], initialValue: []): []', gave the following error.
    Type 'never[]' is not assignable to type '[]'.
      Target allows only 0 element(s) but source may have more.
tests/cases/compiler/destructuringTuple.ts(11,60): error TS2769: No overload matches this call.
  Overload 1 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.
    Argument of type 'number' is not assignable to parameter of type 'ConcatArray<never>'.
  Overload 2 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.
    Argument of type 'number' is not assignable to parameter of type 'ConcatArray<never>'.


==== tests/cases/compiler/destructuringTuple.ts (3 errors) ====
    declare var tuple: [boolean, number, ...string[]];
    
    const [a, b, c, ...rest] = tuple;
    
    declare var receiver: typeof tuple;
    
    [...receiver] = tuple;
    
    // Repros from #32140
    
    const [oops1] = [1, 2, 3].reduce((accu, el) => accu.concat(el), []);
          ~~~~~~~
!!! error TS2461: Type 'number' is not an array type.
                                                   ~~~~~~~~~~~~~~~
!!! error TS2769: No overload matches this call.
!!! error TS2769:   Overload 1 of 3, '(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number', gave the following error.
!!! error TS2769:     Type 'never[]' is not assignable to type 'number'.
!!! error TS2769:   Overload 2 of 3, '(callbackfn: (previousValue: [], currentValue: number, currentIndex: number, array: number[]) => [], initialValue: []): []', gave the following error.
!!! error TS2769:     Type 'never[]' is not assignable to type '[]'.
!!! error TS2769:       Target allows only 0 element(s) but source may have more.
!!! related TS6502 /.ts/lib.es5.d.ts:--:--: The expected type comes from the return type of this signature.
!!! related TS6502 /.ts/lib.es5.d.ts:--:--: The expected type comes from the return type of this signature.
                                                               ~~
!!! error TS2769: No overload matches this call.
!!! error TS2769:   Overload 1 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.
!!! error TS2769:     Argument of type 'number' is not assignable to parameter of type 'ConcatArray<never>'.
!!! error TS2769:   Overload 2 of 2, '(...items: ConcatArray<never>[]): never[]', gave the following error.
!!! error TS2769:     Argument of type 'number' is not assignable to parameter of type 'ConcatArray<never>'.
    
    const [oops2] = [1, 2, 3].reduce((acc: number[], e) => acc.concat(e), []);