Skip to content

Commit f56c02b

Browse files
committed
Better typings for Array.concat()
1 parent c0573c5 commit f56c02b

File tree

48 files changed

+147
-161
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+147
-161
lines changed

src/lib/es5.d.ts

+20
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,16 @@ interface ReadonlyArray<T> {
10861086
* @param items Additional items to add to the end of array1.
10871087
*/
10881088
concat(...items: (T | ConcatArray<T>)[]): T[];
1089+
/**
1090+
* Combines two or more arrays.
1091+
* @param items Additional items to add to the end of array1.
1092+
*/
1093+
concat<U>(...items: ConcatArray<U>[]): (T | U)[];
1094+
/**
1095+
* Combines two or more arrays.
1096+
* @param items Additional items to add to the end of array1.
1097+
*/
1098+
concat<U>(...items: (U | ConcatArray<U>)[]): (T | U)[];
10891099
/**
10901100
* Adds all the elements of an array separated by the specified separator string.
10911101
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
@@ -1214,6 +1224,16 @@ interface Array<T> {
12141224
* @param items Additional items to add to the end of array1.
12151225
*/
12161226
concat(...items: (T | ConcatArray<T>)[]): T[];
1227+
/**
1228+
* Combines two or more arrays.
1229+
* @param items Additional items to add to the end of array1.
1230+
*/
1231+
concat<U>(...items: ConcatArray<U>[]): (T | U)[];
1232+
/**
1233+
* Combines two or more arrays.
1234+
* @param items Additional items to add to the end of array1.
1235+
*/
1236+
concat<U>(...items: (U | ConcatArray<U>)[]): (T | U)[];
12171237
/**
12181238
* Adds all the elements of an array separated by the specified separator string.
12191239
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.

tests/baselines/reference/arrayConcat2.symbols

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ var a: string[] = [];
33
>a : Symbol(a, Decl(arrayConcat2.ts, 0, 3))
44

55
a.concat("hello", 'world');
6-
>a.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
6+
>a.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
77
>a : Symbol(a, Decl(arrayConcat2.ts, 0, 3))
8-
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
8+
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
99

1010
a.concat('Hello');
11-
>a.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
11+
>a.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
1212
>a : Symbol(a, Decl(arrayConcat2.ts, 0, 3))
13-
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
13+
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
1414

1515
var b = new Array<string>();
1616
>b : Symbol(b, Decl(arrayConcat2.ts, 5, 3))
1717
>Array : Symbol(Array, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
1818

1919
b.concat('hello');
20-
>b.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
20+
>b.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
2121
>b : Symbol(b, Decl(arrayConcat2.ts, 5, 3))
22-
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
22+
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
2323

tests/baselines/reference/arrayConcat2.types

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ var a: string[] = [];
55

66
a.concat("hello", 'world');
77
>a.concat("hello", 'world') : string[]
8-
>a.concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
8+
>a.concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; <U>(...items: ConcatArray<U>[]): (string | U)[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
99
>a : string[]
10-
>concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
10+
>concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; <U>(...items: ConcatArray<U>[]): (string | U)[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
1111
>"hello" : "hello"
1212
>'world' : "world"
1313

1414
a.concat('Hello');
1515
>a.concat('Hello') : string[]
16-
>a.concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
16+
>a.concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; <U>(...items: ConcatArray<U>[]): (string | U)[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
1717
>a : string[]
18-
>concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
18+
>concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; <U>(...items: ConcatArray<U>[]): (string | U)[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
1919
>'Hello' : "Hello"
2020

2121
var b = new Array<string>();
@@ -25,8 +25,8 @@ var b = new Array<string>();
2525

2626
b.concat('hello');
2727
>b.concat('hello') : string[]
28-
>b.concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
28+
>b.concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; <U>(...items: ConcatArray<U>[]): (string | U)[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
2929
>b : string[]
30-
>concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; }
30+
>concat : { (...items: ConcatArray<string>[]): string[]; (...items: (string | ConcatArray<string>)[]): string[]; <U>(...items: ConcatArray<U>[]): (string | U)[]; <U>(...items: (U | ConcatArray<U>)[]): (string | U)[]; }
3131
>'hello' : "hello"
3232

tests/baselines/reference/arrayConcat3.symbols

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ function doStuff<T extends object, T1 extends T>(a: Array<Fn<T>>, b: Array<Fn<T1
2424
>T1 : Symbol(T1, Decl(arrayConcat3.ts, 2, 34))
2525

2626
b.concat(a);
27-
>b.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
27+
>b.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
2828
>b : Symbol(b, Decl(arrayConcat3.ts, 2, 65))
29-
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
29+
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
3030
>a : Symbol(a, Decl(arrayConcat3.ts, 2, 49))
3131
}
3232

tests/baselines/reference/arrayConcat3.types

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ function doStuff<T extends object, T1 extends T>(a: Array<Fn<T>>, b: Array<Fn<T1
1111

1212
b.concat(a);
1313
>b.concat(a) : Fn<T1>[]
14-
>b.concat : { (...items: ConcatArray<Fn<T1>>[]): Fn<T1>[]; (...items: (Fn<T1> | ConcatArray<Fn<T1>>)[]): Fn<T1>[]; }
14+
>b.concat : { (...items: ConcatArray<Fn<T1>>[]): Fn<T1>[]; (...items: (Fn<T1> | ConcatArray<Fn<T1>>)[]): Fn<T1>[]; <U>(...items: ConcatArray<U>[]): (Fn<T1> | U)[]; <U>(...items: (U | ConcatArray<U>)[]): (Fn<T1> | U)[]; }
1515
>b : Fn<T1>[]
16-
>concat : { (...items: ConcatArray<Fn<T1>>[]): Fn<T1>[]; (...items: (Fn<T1> | ConcatArray<Fn<T1>>)[]): Fn<T1>[]; }
16+
>concat : { (...items: ConcatArray<Fn<T1>>[]): Fn<T1>[]; (...items: (Fn<T1> | ConcatArray<Fn<T1>>)[]): Fn<T1>[]; <U>(...items: ConcatArray<U>[]): (Fn<T1> | U)[]; <U>(...items: (U | ConcatArray<U>)[]): (Fn<T1> | U)[]; }
1717
>a : Fn<T>[]
1818
}
1919

tests/baselines/reference/arrayConcatMap.symbols

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
var x = [].concat([{ a: 1 }], [{ a: 2 }])
33
>x : Symbol(x, Decl(arrayConcatMap.ts, 0, 3))
44
>[].concat([{ a: 1 }], [{ a: 2 }]) .map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --))
5-
>[].concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
6-
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
5+
>[].concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
6+
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
77
>a : Symbol(a, Decl(arrayConcatMap.ts, 0, 20))
88
>a : Symbol(a, Decl(arrayConcatMap.ts, 0, 32))
99

tests/baselines/reference/arrayConcatMap.types

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ var x = [].concat([{ a: 1 }], [{ a: 2 }])
44
>[].concat([{ a: 1 }], [{ a: 2 }]) .map(b => b.a) : any[]
55
>[].concat([{ a: 1 }], [{ a: 2 }]) .map : <U>(callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[]
66
>[].concat([{ a: 1 }], [{ a: 2 }]) : any[]
7-
>[].concat : { (...items: ConcatArray<any>[]): any[]; (...items: any[]): any[]; }
7+
>[].concat : { (...items: ConcatArray<any>[]): any[]; (...items: any[]): any[]; <U>(...items: ConcatArray<U>[]): any[]; <U>(...items: (U | ConcatArray<U>)[]): any[]; }
88
>[] : undefined[]
9-
>concat : { (...items: ConcatArray<any>[]): any[]; (...items: any[]): any[]; }
9+
>concat : { (...items: ConcatArray<any>[]): any[]; (...items: any[]): any[]; <U>(...items: ConcatArray<U>[]): any[]; <U>(...items: (U | ConcatArray<U>)[]): any[]; }
1010
>[{ a: 1 }] : { a: number; }[]
1111
>{ a: 1 } : { a: number; }
1212
>a : number

tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(13,1): error TS2322: Type 'A[]' is not assignable to type 'readonly B[]'.
22
Property 'b' is missing in type 'A' but required in type 'B'.
33
tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error TS2322: Type 'C<A>' is not assignable to type 'readonly B[]'.
4-
The types returned by 'concat(...)' are incompatible between these types.
4+
The types returned by 'slice(...)' are incompatible between these types.
55
Type 'A[]' is not assignable to type 'B[]'.
66
Type 'A' is not assignable to type 'B'.
77

@@ -31,7 +31,7 @@ tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error T
3131
rrb = cra; // error: 'A' is not assignable to 'B'
3232
~~~
3333
!!! error TS2322: Type 'C<A>' is not assignable to type 'readonly B[]'.
34-
!!! error TS2322: The types returned by 'concat(...)' are incompatible between these types.
34+
!!! error TS2322: The types returned by 'slice(...)' are incompatible between these types.
3535
!!! error TS2322: Type 'A[]' is not assignable to type 'B[]'.
3636
!!! error TS2322: Type 'A' is not assignable to type 'B'.
3737

tests/baselines/reference/concatError.symbols

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ var fa: number[];
1313

1414
fa = fa.concat([0]);
1515
>fa : Symbol(fa, Decl(concatError.ts, 7, 3))
16-
>fa.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
16+
>fa.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
1717
>fa : Symbol(fa, Decl(concatError.ts, 7, 3))
18-
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
18+
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
1919

2020
fa = fa.concat(0);
2121
>fa : Symbol(fa, Decl(concatError.ts, 7, 3))
22-
>fa.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
22+
>fa.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
2323
>fa : Symbol(fa, Decl(concatError.ts, 7, 3))
24-
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
24+
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
2525

2626

2727

tests/baselines/reference/concatError.types

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ fa = fa.concat([0]);
1515
>fa = fa.concat([0]) : number[]
1616
>fa : number[]
1717
>fa.concat([0]) : number[]
18-
>fa.concat : { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; }
18+
>fa.concat : { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; <U>(...items: ConcatArray<U>[]): (number | U)[]; <U>(...items: (U | ConcatArray<U>)[]): (number | U)[]; }
1919
>fa : number[]
20-
>concat : { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; }
20+
>concat : { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; <U>(...items: ConcatArray<U>[]): (number | U)[]; <U>(...items: (U | ConcatArray<U>)[]): (number | U)[]; }
2121
>[0] : number[]
2222
>0 : 0
2323

2424
fa = fa.concat(0);
2525
>fa = fa.concat(0) : number[]
2626
>fa : number[]
2727
>fa.concat(0) : number[]
28-
>fa.concat : { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; }
28+
>fa.concat : { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; <U>(...items: ConcatArray<U>[]): (number | U)[]; <U>(...items: (U | ConcatArray<U>)[]): (number | U)[]; }
2929
>fa : number[]
30-
>concat : { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; }
30+
>concat : { (...items: ConcatArray<number>[]): number[]; (...items: (number | ConcatArray<number>)[]): number[]; <U>(...items: ConcatArray<U>[]): (number | U)[]; <U>(...items: (U | ConcatArray<U>)[]): (number | U)[]; }
3131
>0 : 0
3232

3333

tests/baselines/reference/concatTuples.symbols

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ let ijs: [number, number][] = [[1, 2]];
44

55
ijs = ijs.concat([[3, 4], [5, 6]]);
66
>ijs : Symbol(ijs, Decl(concatTuples.ts, 0, 3))
7-
>ijs.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
7+
>ijs.concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
88
>ijs : Symbol(ijs, Decl(concatTuples.ts, 0, 3))
9-
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
9+
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
1010

tests/baselines/reference/concatTuples.types

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ ijs = ijs.concat([[3, 4], [5, 6]]);
1010
>ijs = ijs.concat([[3, 4], [5, 6]]) : [number, number][]
1111
>ijs : [number, number][]
1212
>ijs.concat([[3, 4], [5, 6]]) : [number, number][]
13-
>ijs.concat : { (...items: ConcatArray<[number, number]>[]): [number, number][]; (...items: ([number, number] | ConcatArray<[number, number]>)[]): [number, number][]; }
13+
>ijs.concat : { (...items: ConcatArray<[number, number]>[]): [number, number][]; (...items: ([number, number] | ConcatArray<[number, number]>)[]): [number, number][]; <U>(...items: ConcatArray<U>[]): ([number, number] | U)[]; <U>(...items: (U | ConcatArray<U>)[]): ([number, number] | U)[]; }
1414
>ijs : [number, number][]
15-
>concat : { (...items: ConcatArray<[number, number]>[]): [number, number][]; (...items: ([number, number] | ConcatArray<[number, number]>)[]): [number, number][]; }
15+
>concat : { (...items: ConcatArray<[number, number]>[]): [number, number][]; (...items: ([number, number] | ConcatArray<[number, number]>)[]): [number, number][]; <U>(...items: ConcatArray<U>[]): ([number, number] | U)[]; <U>(...items: (U | ConcatArray<U>)[]): ([number, number] | U)[]; }
1616
>[[3, 4], [5, 6]] : [number, number][]
1717
>[3, 4] : [number, number]
1818
>3 : 3

tests/baselines/reference/contextualExpressionTypecheckingDoesntBlowStack.symbols

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ export default class Operation {
4747
// Commenting out this line will fix the problem.
4848
result = (result || []).concat(innerResult);
4949
>result : Symbol(result, Decl(contextualExpressionTypecheckingDoesntBlowStack.ts, 7, 11))
50-
>(result || []).concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
50+
>(result || []).concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
5151
>result : Symbol(result, Decl(contextualExpressionTypecheckingDoesntBlowStack.ts, 7, 11))
52-
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
52+
>concat : Symbol(Array.concat, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
5353
>innerResult : Symbol(innerResult, Decl(contextualExpressionTypecheckingDoesntBlowStack.ts, 12, 17))
5454
}
5555
}

tests/baselines/reference/contextualExpressionTypecheckingDoesntBlowStack.types

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ export default class Operation {
6969

7070
// Commenting out this line will fix the problem.
7171
result = (result || []).concat(innerResult);
72-
>result = (result || []).concat(innerResult) : IValidationError[]
72+
>result = (result || []).concat(innerResult) : any[]
7373
>result : IValidationError[] | null
74-
>(result || []).concat(innerResult) : IValidationError[]
75-
>(result || []).concat : { (...items: ConcatArray<IValidationError>[]): IValidationError[]; (...items: (IValidationError | ConcatArray<IValidationError>)[]): IValidationError[]; }
74+
>(result || []).concat(innerResult) : any[]
75+
>(result || []).concat : { (...items: ConcatArray<IValidationError>[]): IValidationError[]; (...items: (IValidationError | ConcatArray<IValidationError>)[]): IValidationError[]; <U>(...items: ConcatArray<U>[]): (IValidationError | U)[]; <U>(...items: (U | ConcatArray<U>)[]): (IValidationError | U)[]; }
7676
>(result || []) : IValidationError[]
7777
>result || [] : IValidationError[]
7878
>result : IValidationError[] | null
7979
>[] : never[]
80-
>concat : { (...items: ConcatArray<IValidationError>[]): IValidationError[]; (...items: (IValidationError | ConcatArray<IValidationError>)[]): IValidationError[]; }
80+
>concat : { (...items: ConcatArray<IValidationError>[]): IValidationError[]; (...items: (IValidationError | ConcatArray<IValidationError>)[]): IValidationError[]; <U>(...items: ConcatArray<U>[]): (IValidationError | U)[]; <U>(...items: (U | ConcatArray<U>)[]): (IValidationError | U)[]; }
8181
>innerResult : any
8282
}
8383
}

tests/baselines/reference/destructuringParameterDeclaration4.errors.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ tests/cases/conformance/es6/destructuring/destructuringParameterDeclaration4.ts(
4141
a1(...array2); // Error parameter type is (number|string)[]
4242
~~~~~~
4343
!!! error TS2552: Cannot find name 'array2'. Did you mean 'Array'?
44-
!!! related TS2728 /.ts/lib.es5.d.ts:1373:13: 'Array' is declared here.
44+
!!! related TS2728 /.ts/lib.es5.d.ts:1393:13: 'Array' is declared here.
4545
a5([1, 2, "string", false, true]); // Error, parameter type is [any, any, [[any]]]
4646
~~~~~~~~
4747
!!! error TS2322: Type 'string' is not assignable to type '[[any]]'.

0 commit comments

Comments
 (0)