TypeScript/tests/baselines/reference/destructuringTuple.errors.txt
Andrew Branch 039672332f
Revert "Stop looking at binding patterns for type argument inference" (#46013)
* Revert "Stop looking at binding patterns for type argument inference (#45719)"

This reverts commit be618b1446.

* Update error baseline for moved lib file declaration
2021-09-23 09:26:51 -07:00

46 lines
3.2 KiB
Plaintext

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:1429:24: The expected type comes from the return type of this signature.
!!! related TS6502 /.ts/lib.es5.d.ts:1435:27: 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), []);