You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Array.concat now takes ConcatArray, not ReadonlyArray (#21462)
* Overloads in Array.concat now handle ReadonlyArray
Previously it was union types, which is slower.
* Make arrayConcat3 test stricter
* Switch to InputArray instead of adding overloads
* Update baselines
* Update baselines correctly
* Rename to ConcatArray and add slice method
Should make it, respectively, easier to understand this specific type
and harder to satisfy it by mistake.
* Adds all the elements of an array separated by the specified separator string.
1003
1003
* @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.
* Adds all the elements of an array separated by the specified separator string.
1124
1131
* @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.
Copy file name to clipboardExpand all lines: tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt
+4-4
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(13,1): error TS2322: Type 'A[]' is not assignable to type 'ReadonlyArray<B>'.
2
2
Types of property 'concat' are incompatible.
3
-
Type '{ (...items: (A[] | ReadonlyArray<A>)[]): A[]; (...items: (A | A[] | ReadonlyArray<A>)[]): A[]; }' is not assignable to type '{ (...items: (B[] | ReadonlyArray<B>)[]): B[]; (...items: (B | B[] | ReadonlyArray<B>)[]): B[]; }'.
3
+
Type '{ (...items: ConcatArray<A>[]): A[]; (...items: (A | ConcatArray<A>)[]): A[]; }' is not assignable to type '{ (...items: ConcatArray<B>[]): B[]; (...items: (B | ConcatArray<B>)[]): B[]; }'.
4
4
Type 'A[]' is not assignable to type 'B[]'.
5
5
Type 'A' is not assignable to type 'B'.
6
6
Property 'b' is missing in type 'A'.
7
7
tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error TS2322: Type 'C<A>' is not assignable to type 'ReadonlyArray<B>'.
8
8
Types of property 'concat' are incompatible.
9
-
Type '{ (...items: (A[] | ReadonlyArray<A>)[]): A[]; (...items: (A | A[] | ReadonlyArray<A>)[]): A[]; }' is not assignable to type '{ (...items: (B[] | ReadonlyArray<B>)[]): B[]; (...items: (B | B[] | ReadonlyArray<B>)[]): B[]; }'.
9
+
Type '{ (...items: ConcatArray<A>[]): A[]; (...items: (A | ConcatArray<A>)[]): A[]; }' is not assignable to type '{ (...items: ConcatArray<B>[]): B[]; (...items: (B | ConcatArray<B>)[]): B[]; }'.
10
10
Type 'A[]' is not assignable to type 'B[]'.
11
11
12
12
@@ -27,7 +27,7 @@ tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error T
27
27
~~~
28
28
!!! error TS2322: Type 'A[]' is not assignable to type 'ReadonlyArray<B>'.
29
29
!!! error TS2322: Types of property 'concat' are incompatible.
30
-
!!! error TS2322: Type '{ (...items: (A[] | ReadonlyArray<A>)[]): A[]; (...items: (A | A[] | ReadonlyArray<A>)[]): A[]; }' is not assignable to type '{ (...items: (B[] | ReadonlyArray<B>)[]): B[]; (...items: (B | B[] | ReadonlyArray<B>)[]): B[]; }'.
30
+
!!! error TS2322: Type '{ (...items: ConcatArray<A>[]): A[]; (...items: (A | ConcatArray<A>)[]): A[]; }' is not assignable to type '{ (...items: ConcatArray<B>[]): B[]; (...items: (B | ConcatArray<B>)[]): B[]; }'.
31
31
!!! error TS2322: Type 'A[]' is not assignable to type 'B[]'.
32
32
!!! error TS2322: Type 'A' is not assignable to type 'B'.
33
33
!!! error TS2322: Property 'b' is missing in type 'A'.
@@ -39,6 +39,6 @@ tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error T
39
39
~~~
40
40
!!! error TS2322: Type 'C<A>' is not assignable to type 'ReadonlyArray<B>'.
41
41
!!! error TS2322: Types of property 'concat' are incompatible.
42
-
!!! error TS2322: Type '{ (...items: (A[] | ReadonlyArray<A>)[]): A[]; (...items: (A | A[] | ReadonlyArray<A>)[]): A[]; }' is not assignable to type '{ (...items: (B[] | ReadonlyArray<B>)[]): B[]; (...items: (B | B[] | ReadonlyArray<B>)[]): B[]; }'.
42
+
!!! error TS2322: Type '{ (...items: ConcatArray<A>[]): A[]; (...items: (A | ConcatArray<A>)[]): A[]; }' is not assignable to type '{ (...items: ConcatArray<B>[]): B[]; (...items: (B | ConcatArray<B>)[]): B[]; }'.
43
43
!!! error TS2322: Type 'A[]' is not assignable to type 'B[]'.
tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(15,14): error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number | number[] | ReadonlyArray<number>'.
2
-
Type 'symbol[]' is not assignable to type 'ReadonlyArray<number>'.
3
-
Types of property 'concat' are incompatible.
4
-
Type '{ (...items: (symbol[] | ReadonlyArray<symbol>)[]): symbol[]; (...items: (symbol | symbol[] | ReadonlyArray<symbol>)[]): symbol[]; }' is not assignable to type '{ (...items: (number[] | ReadonlyArray<number>)[]): number[]; (...items: (number | number[] | ReadonlyArray<number>)[]): number[]; }'.
5
-
Types of parameters 'items' and 'items' are incompatible.
6
-
Type 'number[] | ReadonlyArray<number>' is not assignable to type 'symbol[] | ReadonlyArray<symbol>'.
7
-
Type 'number[]' is not assignable to type 'symbol[] | ReadonlyArray<symbol>'.
8
-
Type 'number[]' is not assignable to type 'ReadonlyArray<symbol>'.
9
-
Types of property 'concat' are incompatible.
10
-
Type '{ (...items: (number[] | ReadonlyArray<number>)[]): number[]; (...items: (number | number[] | ReadonlyArray<number>)[]): number[]; }' is not assignable to type '{ (...items: (symbol[] | ReadonlyArray<symbol>)[]): symbol[]; (...items: (symbol | symbol[] | ReadonlyArray<symbol>)[]): symbol[]; }'.
11
-
Types of parameters 'items' and 'items' are incompatible.
12
-
Type 'symbol[] | ReadonlyArray<symbol>' is not assignable to type 'number[] | ReadonlyArray<number>'.
13
-
Type 'symbol[]' is not assignable to type 'number[] | ReadonlyArray<number>'.
14
-
Type 'symbol[]' is not assignable to type 'ReadonlyArray<number>'.
1
+
tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(15,14): error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number | ConcatArray<number>'.
2
+
Type 'symbol[]' is not assignable to type 'ConcatArray<number>'.
3
+
Types of property 'slice' are incompatible.
4
+
Type '(start?: number, end?: number) => symbol[]' is not assignable to type '(start?: number, end?: number) => number[]'.
5
+
Type 'symbol[]' is not assignable to type 'number[]'.
0 commit comments