diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 0f1a68de4c20d..707f749e36503 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -992,12 +992,12 @@ interface ReadonlyArray { * Combines two or more arrays. * @param items Additional items to add to the end of array1. */ - concat(...items: (T[] | ReadonlyArray)[]): T[]; + concat(...items: ConcatArray[]): T[]; /** * Combines two or more arrays. * @param items Additional items to add to the end of array1. */ - concat(...items: (T | T[] | ReadonlyArray)[]): T[]; + concat(...items: (T | ConcatArray)[]): T[]; /** * Adds all the elements of an array separated by the specified separator string. * @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. @@ -1087,6 +1087,13 @@ interface ReadonlyArray { readonly [n: number]: T; } +interface ConcatArray { + readonly length: number; + readonly [n: number]: T; + join(separator?: string): string; + slice(start?: number, end?: number): T[]; +} + interface Array { /** * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. @@ -1113,12 +1120,12 @@ interface Array { * Combines two or more arrays. * @param items Additional items to add to the end of array1. */ - concat(...items: (T[] | ReadonlyArray)[]): T[]; + concat(...items: ConcatArray[]): T[]; /** * Combines two or more arrays. * @param items Additional items to add to the end of array1. */ - concat(...items: (T | T[] | ReadonlyArray)[]): T[]; + concat(...items: (T | ConcatArray)[]): T[]; /** * Adds all the elements of an array separated by the specified separator string. * @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. diff --git a/tests/baselines/reference/arrayConcat2.types b/tests/baselines/reference/arrayConcat2.types index 2e33d4cd023b3..f1ca2a5f10977 100644 --- a/tests/baselines/reference/arrayConcat2.types +++ b/tests/baselines/reference/arrayConcat2.types @@ -5,17 +5,17 @@ var a: string[] = []; a.concat("hello", 'world'); >a.concat("hello", 'world') : string[] ->a.concat : { (...items: (string[] | ReadonlyArray)[]): string[]; (...items: (string | string[] | ReadonlyArray)[]): string[]; } +>a.concat : { (...items: ConcatArray[]): string[]; (...items: (string | ConcatArray)[]): string[]; } >a : string[] ->concat : { (...items: (string[] | ReadonlyArray)[]): string[]; (...items: (string | string[] | ReadonlyArray)[]): string[]; } +>concat : { (...items: ConcatArray[]): string[]; (...items: (string | ConcatArray)[]): string[]; } >"hello" : "hello" >'world' : "world" a.concat('Hello'); >a.concat('Hello') : string[] ->a.concat : { (...items: (string[] | ReadonlyArray)[]): string[]; (...items: (string | string[] | ReadonlyArray)[]): string[]; } +>a.concat : { (...items: ConcatArray[]): string[]; (...items: (string | ConcatArray)[]): string[]; } >a : string[] ->concat : { (...items: (string[] | ReadonlyArray)[]): string[]; (...items: (string | string[] | ReadonlyArray)[]): string[]; } +>concat : { (...items: ConcatArray[]): string[]; (...items: (string | ConcatArray)[]): string[]; } >'Hello' : "Hello" var b = new Array(); @@ -25,8 +25,8 @@ var b = new Array(); b.concat('hello'); >b.concat('hello') : string[] ->b.concat : { (...items: (string[] | ReadonlyArray)[]): string[]; (...items: (string | string[] | ReadonlyArray)[]): string[]; } +>b.concat : { (...items: ConcatArray[]): string[]; (...items: (string | ConcatArray)[]): string[]; } >b : string[] ->concat : { (...items: (string[] | ReadonlyArray)[]): string[]; (...items: (string | string[] | ReadonlyArray)[]): string[]; } +>concat : { (...items: ConcatArray[]): string[]; (...items: (string | ConcatArray)[]): string[]; } >'hello' : "hello" diff --git a/tests/baselines/reference/arrayConcat3.types b/tests/baselines/reference/arrayConcat3.types index 2bfbe09a1765d..33321c4321781 100644 --- a/tests/baselines/reference/arrayConcat3.types +++ b/tests/baselines/reference/arrayConcat3.types @@ -25,9 +25,9 @@ function doStuff(a: Array>, b: Arrayb.concat(a) : Fn[] ->b.concat : { (...items: (Fn[] | ReadonlyArray>)[]): Fn[]; (...items: (Fn | Fn[] | ReadonlyArray>)[]): Fn[]; } +>b.concat : { (...items: ConcatArray>[]): Fn[]; (...items: (Fn | ConcatArray>)[]): Fn[]; } >b : Fn[] ->concat : { (...items: (Fn[] | ReadonlyArray>)[]): Fn[]; (...items: (Fn | Fn[] | ReadonlyArray>)[]): Fn[]; } +>concat : { (...items: ConcatArray>[]): Fn[]; (...items: (Fn | ConcatArray>)[]): Fn[]; } >a : Fn[] } diff --git a/tests/baselines/reference/arrayConcatMap.types b/tests/baselines/reference/arrayConcatMap.types index cbb30b8304ad6..ffc49e548a350 100644 --- a/tests/baselines/reference/arrayConcatMap.types +++ b/tests/baselines/reference/arrayConcatMap.types @@ -4,9 +4,9 @@ var x = [].concat([{ a: 1 }], [{ a: 2 }]) >[].concat([{ a: 1 }], [{ a: 2 }]) .map(b => b.a) : any[] >[].concat([{ a: 1 }], [{ a: 2 }]) .map : (callbackfn: (value: any, index: number, array: any[]) => U, thisArg?: any) => U[] >[].concat([{ a: 1 }], [{ a: 2 }]) : any[] ->[].concat : { (...items: (any[] | ReadonlyArray)[]): any[]; (...items: any[]): any[]; } +>[].concat : { (...items: ConcatArray[]): any[]; (...items: any[]): any[]; } >[] : undefined[] ->concat : { (...items: (any[] | ReadonlyArray)[]): any[]; (...items: any[]): any[]; } +>concat : { (...items: ConcatArray[]): any[]; (...items: any[]): any[]; } >[{ a: 1 }] : { a: number; }[] >{ a: 1 } : { a: number; } >a : number diff --git a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt index 87c8b59ee1e61..7ae20699c85ff 100644 --- a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt +++ b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt @@ -1,12 +1,12 @@ tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(13,1): error TS2322: Type 'A[]' is not assignable to type 'ReadonlyArray'. Types of property 'concat' are incompatible. - Type '{ (...items: (A[] | ReadonlyArray)[]): A[]; (...items: (A | A[] | ReadonlyArray)[]): A[]; }' is not assignable to type '{ (...items: (B[] | ReadonlyArray)[]): B[]; (...items: (B | B[] | ReadonlyArray)[]): B[]; }'. + Type '{ (...items: ConcatArray[]): A[]; (...items: (A | ConcatArray)[]): A[]; }' is not assignable to type '{ (...items: ConcatArray[]): B[]; (...items: (B | ConcatArray)[]): B[]; }'. Type 'A[]' is not assignable to type 'B[]'. Type 'A' is not assignable to type 'B'. Property 'b' is missing in type 'A'. tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error TS2322: Type 'C' is not assignable to type 'ReadonlyArray'. Types of property 'concat' are incompatible. - Type '{ (...items: (A[] | ReadonlyArray)[]): A[]; (...items: (A | A[] | ReadonlyArray)[]): A[]; }' is not assignable to type '{ (...items: (B[] | ReadonlyArray)[]): B[]; (...items: (B | B[] | ReadonlyArray)[]): B[]; }'. + Type '{ (...items: ConcatArray[]): A[]; (...items: (A | ConcatArray)[]): A[]; }' is not assignable to type '{ (...items: ConcatArray[]): B[]; (...items: (B | ConcatArray)[]): B[]; }'. Type 'A[]' is not assignable to type 'B[]'. @@ -27,7 +27,7 @@ tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error T ~~~ !!! error TS2322: Type 'A[]' is not assignable to type 'ReadonlyArray'. !!! error TS2322: Types of property 'concat' are incompatible. -!!! error TS2322: Type '{ (...items: (A[] | ReadonlyArray)[]): A[]; (...items: (A | A[] | ReadonlyArray)[]): A[]; }' is not assignable to type '{ (...items: (B[] | ReadonlyArray)[]): B[]; (...items: (B | B[] | ReadonlyArray)[]): B[]; }'. +!!! error TS2322: Type '{ (...items: ConcatArray[]): A[]; (...items: (A | ConcatArray)[]): A[]; }' is not assignable to type '{ (...items: ConcatArray[]): B[]; (...items: (B | ConcatArray)[]): B[]; }'. !!! error TS2322: Type 'A[]' is not assignable to type 'B[]'. !!! error TS2322: Type 'A' is not assignable to type 'B'. !!! error TS2322: Property 'b' is missing in type 'A'. @@ -39,6 +39,6 @@ tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(18,1): error T ~~~ !!! error TS2322: Type 'C' is not assignable to type 'ReadonlyArray'. !!! error TS2322: Types of property 'concat' are incompatible. -!!! error TS2322: Type '{ (...items: (A[] | ReadonlyArray)[]): A[]; (...items: (A | A[] | ReadonlyArray)[]): A[]; }' is not assignable to type '{ (...items: (B[] | ReadonlyArray)[]): B[]; (...items: (B | B[] | ReadonlyArray)[]): B[]; }'. +!!! error TS2322: Type '{ (...items: ConcatArray[]): A[]; (...items: (A | ConcatArray)[]): A[]; }' is not assignable to type '{ (...items: ConcatArray[]): B[]; (...items: (B | ConcatArray)[]): B[]; }'. !!! error TS2322: Type 'A[]' is not assignable to type 'B[]'. \ No newline at end of file diff --git a/tests/baselines/reference/concatError.types b/tests/baselines/reference/concatError.types index c7f07e4ea9605..52f413b20b6b4 100644 --- a/tests/baselines/reference/concatError.types +++ b/tests/baselines/reference/concatError.types @@ -15,9 +15,9 @@ fa = fa.concat([0]); >fa = fa.concat([0]) : number[] >fa : number[] >fa.concat([0]) : number[] ->fa.concat : { (...items: (number[] | ReadonlyArray)[]): number[]; (...items: (number | number[] | ReadonlyArray)[]): number[]; } +>fa.concat : { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; } >fa : number[] ->concat : { (...items: (number[] | ReadonlyArray)[]): number[]; (...items: (number | number[] | ReadonlyArray)[]): number[]; } +>concat : { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; } >[0] : number[] >0 : 0 @@ -25,9 +25,9 @@ fa = fa.concat(0); >fa = fa.concat(0) : number[] >fa : number[] >fa.concat(0) : number[] ->fa.concat : { (...items: (number[] | ReadonlyArray)[]): number[]; (...items: (number | number[] | ReadonlyArray)[]): number[]; } +>fa.concat : { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; } >fa : number[] ->concat : { (...items: (number[] | ReadonlyArray)[]): number[]; (...items: (number | number[] | ReadonlyArray)[]): number[]; } +>concat : { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; } >0 : 0 diff --git a/tests/baselines/reference/concatTuples.types b/tests/baselines/reference/concatTuples.types index 46c06357b998b..d85ee92557041 100644 --- a/tests/baselines/reference/concatTuples.types +++ b/tests/baselines/reference/concatTuples.types @@ -10,9 +10,9 @@ ijs = ijs.concat([[3, 4], [5, 6]]); >ijs = ijs.concat([[3, 4], [5, 6]]) : [number, number][] >ijs : [number, number][] >ijs.concat([[3, 4], [5, 6]]) : [number, number][] ->ijs.concat : { (...items: ([number, number][] | ReadonlyArray<[number, number]>)[]): [number, number][]; (...items: ([number, number] | [number, number][] | ReadonlyArray<[number, number]>)[]): [number, number][]; } +>ijs.concat : { (...items: ConcatArray<[number, number]>[]): [number, number][]; (...items: ([number, number] | ConcatArray<[number, number]>)[]): [number, number][]; } >ijs : [number, number][] ->concat : { (...items: ([number, number][] | ReadonlyArray<[number, number]>)[]): [number, number][]; (...items: ([number, number] | [number, number][] | ReadonlyArray<[number, number]>)[]): [number, number][]; } +>concat : { (...items: ConcatArray<[number, number]>[]): [number, number][]; (...items: ([number, number] | ConcatArray<[number, number]>)[]): [number, number][]; } >[[3, 4], [5, 6]] : [number, number][] >[3, 4] : [number, number] >3 : 3 diff --git a/tests/baselines/reference/emitSkipsThisWithRestParameter.types b/tests/baselines/reference/emitSkipsThisWithRestParameter.types index 9d560a9e92f19..9aa0e1fa55b66 100644 --- a/tests/baselines/reference/emitSkipsThisWithRestParameter.types +++ b/tests/baselines/reference/emitSkipsThisWithRestParameter.types @@ -18,10 +18,10 @@ function rebase(fn: (base: any, ...args: any[]) => any): (...args: any[]) => any >apply : (this: Function, thisArg: any, argArray?: any) => any >this : any >[ this ].concat(args) : any[] ->[ this ].concat : { (...items: (any[] | ReadonlyArray)[]): any[]; (...items: any[]): any[]; } +>[ this ].concat : { (...items: ConcatArray[]): any[]; (...items: any[]): any[]; } >[ this ] : any[] >this : any ->concat : { (...items: (any[] | ReadonlyArray)[]): any[]; (...items: any[]): any[]; } +>concat : { (...items: ConcatArray[]): any[]; (...items: any[]): any[]; } >args : any[] }; diff --git a/tests/baselines/reference/intersectionTypeInference3.types b/tests/baselines/reference/intersectionTypeInference3.types index e6f411a603c45..6239792f53d9c 100644 --- a/tests/baselines/reference/intersectionTypeInference3.types +++ b/tests/baselines/reference/intersectionTypeInference3.types @@ -32,13 +32,13 @@ declare const b: Set; const c1 = Array.from(a).concat(Array.from(b)); >c1 : Nominal<"A", string>[] >Array.from(a).concat(Array.from(b)) : Nominal<"A", string>[] ->Array.from(a).concat : { (...items: (Nominal<"A", string>[] | ReadonlyArray>)[]): Nominal<"A", string>[]; (...items: (Nominal<"A", string> | Nominal<"A", string>[] | ReadonlyArray>)[]): Nominal<"A", string>[]; } +>Array.from(a).concat : { (...items: ConcatArray>[]): Nominal<"A", string>[]; (...items: (Nominal<"A", string> | ConcatArray>)[]): Nominal<"A", string>[]; } >Array.from(a) : Nominal<"A", string>[] >Array.from : { (iterable: Iterable | ArrayLike): T[]; (iterable: Iterable | ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; } >Array : ArrayConstructor >from : { (iterable: Iterable | ArrayLike): T[]; (iterable: Iterable | ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; } >a : Set> ->concat : { (...items: (Nominal<"A", string>[] | ReadonlyArray>)[]): Nominal<"A", string>[]; (...items: (Nominal<"A", string> | Nominal<"A", string>[] | ReadonlyArray>)[]): Nominal<"A", string>[]; } +>concat : { (...items: ConcatArray>[]): Nominal<"A", string>[]; (...items: (Nominal<"A", string> | ConcatArray>)[]): Nominal<"A", string>[]; } >Array.from(b) : Nominal<"A", string>[] >Array.from : { (iterable: Iterable | ArrayLike): T[]; (iterable: Iterable | ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (arrayLike: ArrayLike): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; } >Array : ArrayConstructor diff --git a/tests/baselines/reference/iteratorSpreadInArray6.errors.txt b/tests/baselines/reference/iteratorSpreadInArray6.errors.txt index 17738ba06d58f..4f547c59ed045 100644 --- a/tests/baselines/reference/iteratorSpreadInArray6.errors.txt +++ b/tests/baselines/reference/iteratorSpreadInArray6.errors.txt @@ -1,17 +1,9 @@ -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'. - Type 'symbol[]' is not assignable to type 'ReadonlyArray'. - Types of property 'concat' are incompatible. - Type '{ (...items: (symbol[] | ReadonlyArray)[]): symbol[]; (...items: (symbol | symbol[] | ReadonlyArray)[]): symbol[]; }' is not assignable to type '{ (...items: (number[] | ReadonlyArray)[]): number[]; (...items: (number | number[] | ReadonlyArray)[]): number[]; }'. - Types of parameters 'items' and 'items' are incompatible. - Type 'number[] | ReadonlyArray' is not assignable to type 'symbol[] | ReadonlyArray'. - Type 'number[]' is not assignable to type 'symbol[] | ReadonlyArray'. - Type 'number[]' is not assignable to type 'ReadonlyArray'. - Types of property 'concat' are incompatible. - Type '{ (...items: (number[] | ReadonlyArray)[]): number[]; (...items: (number | number[] | ReadonlyArray)[]): number[]; }' is not assignable to type '{ (...items: (symbol[] | ReadonlyArray)[]): symbol[]; (...items: (symbol | symbol[] | ReadonlyArray)[]): symbol[]; }'. - Types of parameters 'items' and 'items' are incompatible. - Type 'symbol[] | ReadonlyArray' is not assignable to type 'number[] | ReadonlyArray'. - Type 'symbol[]' is not assignable to type 'number[] | ReadonlyArray'. - Type 'symbol[]' is not assignable to type 'ReadonlyArray'. +tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(15,14): error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number | ConcatArray'. + Type 'symbol[]' is not assignable to type 'ConcatArray'. + Types of property 'slice' are incompatible. + Type '(start?: number, end?: number) => symbol[]' is not assignable to type '(start?: number, end?: number) => number[]'. + Type 'symbol[]' is not assignable to type 'number[]'. + Type 'symbol' is not assignable to type 'number'. ==== tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts (1 errors) ==== @@ -31,17 +23,9 @@ tests/cases/conformance/es6/spread/iteratorSpreadInArray6.ts(15,14): error TS234 var array: number[] = [0, 1]; array.concat([...new SymbolIterator]); ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number | number[] | ReadonlyArray'. -!!! error TS2345: Type 'symbol[]' is not assignable to type 'ReadonlyArray'. -!!! error TS2345: Types of property 'concat' are incompatible. -!!! error TS2345: Type '{ (...items: (symbol[] | ReadonlyArray)[]): symbol[]; (...items: (symbol | symbol[] | ReadonlyArray)[]): symbol[]; }' is not assignable to type '{ (...items: (number[] | ReadonlyArray)[]): number[]; (...items: (number | number[] | ReadonlyArray)[]): number[]; }'. -!!! error TS2345: Types of parameters 'items' and 'items' are incompatible. -!!! error TS2345: Type 'number[] | ReadonlyArray' is not assignable to type 'symbol[] | ReadonlyArray'. -!!! error TS2345: Type 'number[]' is not assignable to type 'symbol[] | ReadonlyArray'. -!!! error TS2345: Type 'number[]' is not assignable to type 'ReadonlyArray'. -!!! error TS2345: Types of property 'concat' are incompatible. -!!! error TS2345: Type '{ (...items: (number[] | ReadonlyArray)[]): number[]; (...items: (number | number[] | ReadonlyArray)[]): number[]; }' is not assignable to type '{ (...items: (symbol[] | ReadonlyArray)[]): symbol[]; (...items: (symbol | symbol[] | ReadonlyArray)[]): symbol[]; }'. -!!! error TS2345: Types of parameters 'items' and 'items' are incompatible. -!!! error TS2345: Type 'symbol[] | ReadonlyArray' is not assignable to type 'number[] | ReadonlyArray'. -!!! error TS2345: Type 'symbol[]' is not assignable to type 'number[] | ReadonlyArray'. -!!! error TS2345: Type 'symbol[]' is not assignable to type 'ReadonlyArray'. \ No newline at end of file +!!! error TS2345: Argument of type 'symbol[]' is not assignable to parameter of type 'number | ConcatArray'. +!!! error TS2345: Type 'symbol[]' is not assignable to type 'ConcatArray'. +!!! error TS2345: Types of property 'slice' are incompatible. +!!! error TS2345: Type '(start?: number, end?: number) => symbol[]' is not assignable to type '(start?: number, end?: number) => number[]'. +!!! error TS2345: Type 'symbol[]' is not assignable to type 'number[]'. +!!! error TS2345: Type 'symbol' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/iteratorSpreadInArray6.types b/tests/baselines/reference/iteratorSpreadInArray6.types index dbf94611fabf6..3fa1720de1460 100644 --- a/tests/baselines/reference/iteratorSpreadInArray6.types +++ b/tests/baselines/reference/iteratorSpreadInArray6.types @@ -38,9 +38,9 @@ var array: number[] = [0, 1]; array.concat([...new SymbolIterator]); >array.concat([...new SymbolIterator]) : any ->array.concat : { (...items: (number[] | ReadonlyArray)[]): number[]; (...items: (number | number[] | ReadonlyArray)[]): number[]; } +>array.concat : { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; } >array : number[] ->concat : { (...items: (number[] | ReadonlyArray)[]): number[]; (...items: (number | number[] | ReadonlyArray)[]): number[]; } +>concat : { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; } >[...new SymbolIterator] : symbol[] >...new SymbolIterator : symbol >new SymbolIterator : SymbolIterator diff --git a/tests/baselines/reference/iteratorSpreadInArray7.types b/tests/baselines/reference/iteratorSpreadInArray7.types index b0d9fbcc77cd5..65c34ae0a6e4a 100644 --- a/tests/baselines/reference/iteratorSpreadInArray7.types +++ b/tests/baselines/reference/iteratorSpreadInArray7.types @@ -35,9 +35,9 @@ var array: symbol[]; array.concat([...new SymbolIterator]); >array.concat([...new SymbolIterator]) : symbol[] ->array.concat : { (...items: (symbol[] | ReadonlyArray)[]): symbol[]; (...items: (symbol | symbol[] | ReadonlyArray)[]): symbol[]; } +>array.concat : { (...items: ConcatArray[]): symbol[]; (...items: (symbol | ConcatArray)[]): symbol[]; } >array : symbol[] ->concat : { (...items: (symbol[] | ReadonlyArray)[]): symbol[]; (...items: (symbol | symbol[] | ReadonlyArray)[]): symbol[]; } +>concat : { (...items: ConcatArray[]): symbol[]; (...items: (symbol | ConcatArray)[]): symbol[]; } >[...new SymbolIterator] : symbol[] >...new SymbolIterator : symbol >new SymbolIterator : SymbolIterator diff --git a/tests/baselines/reference/parserRealSource4.types b/tests/baselines/reference/parserRealSource4.types index cc16886c3d549..175ea23db81ad 100644 --- a/tests/baselines/reference/parserRealSource4.types +++ b/tests/baselines/reference/parserRealSource4.types @@ -424,14 +424,14 @@ module TypeScript { return this.primaryTable.getAllKeys().concat(this.secondaryTable.getAllKeys()); >this.primaryTable.getAllKeys().concat(this.secondaryTable.getAllKeys()) : string[] ->this.primaryTable.getAllKeys().concat : { (...items: (string[] | ReadonlyArray)[]): string[]; (...items: (string | string[] | ReadonlyArray)[]): string[]; } +>this.primaryTable.getAllKeys().concat : { (...items: ConcatArray[]): string[]; (...items: (string | ConcatArray)[]): string[]; } >this.primaryTable.getAllKeys() : string[] >this.primaryTable.getAllKeys : () => string[] >this.primaryTable : IHashTable >this : this >primaryTable : IHashTable >getAllKeys : () => string[] ->concat : { (...items: (string[] | ReadonlyArray)[]): string[]; (...items: (string | string[] | ReadonlyArray)[]): string[]; } +>concat : { (...items: ConcatArray[]): string[]; (...items: (string | ConcatArray)[]): string[]; } >this.secondaryTable.getAllKeys() : string[] >this.secondaryTable.getAllKeys : () => string[] >this.secondaryTable : IHashTable diff --git a/tests/baselines/reference/parserharness.types b/tests/baselines/reference/parserharness.types index 284eb887dd484..61a4a97fc7995 100644 --- a/tests/baselines/reference/parserharness.types +++ b/tests/baselines/reference/parserharness.types @@ -4868,9 +4868,9 @@ module Harness { >lines = lines.concat(v.file.lines) : any[] >lines : any[] >lines.concat(v.file.lines) : any[] ->lines.concat : { (...items: (any[] | ReadonlyArray)[]): any[]; (...items: any[]): any[]; } +>lines.concat : { (...items: ConcatArray[]): any[]; (...items: any[]): any[]; } >lines : any[] ->concat : { (...items: (any[] | ReadonlyArray)[]): any[]; (...items: any[]): any[]; } +>concat : { (...items: ConcatArray[]): any[]; (...items: any[]): any[]; } >v.file.lines : string[] >v.file : WriterAggregator >v : { filename: string; file: WriterAggregator; } diff --git a/tests/baselines/reference/restInvalidArgumentType.types b/tests/baselines/reference/restInvalidArgumentType.types index 389e9a070aaf1..bad3f54c0e88a 100644 --- a/tests/baselines/reference/restInvalidArgumentType.types +++ b/tests/baselines/reference/restInvalidArgumentType.types @@ -87,7 +87,7 @@ function f(p1: T, p2: T[]) { >p1 : T var {...r2} = p2; // OK ->r2 : { [n: number]: T; length: number; toString(): string; toLocaleString(): string; push(...items: T[]): number; pop(): T; concat(...items: (T[] | ReadonlyArray)[]): T[]; concat(...items: (T | T[] | ReadonlyArray)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } +>r2 : { [n: number]: T; length: number; toString(): string; toLocaleString(): string; push(...items: T[]): number; pop(): T; concat(...items: ConcatArray[]): T[]; concat(...items: (T | ConcatArray)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } >p2 : T[] var {...r3} = t; // Error, generic type paramter diff --git a/tests/baselines/reference/spreadInvalidArgumentType.types b/tests/baselines/reference/spreadInvalidArgumentType.types index 49d5bc962611d..d85b974cc8b3a 100644 --- a/tests/baselines/reference/spreadInvalidArgumentType.types +++ b/tests/baselines/reference/spreadInvalidArgumentType.types @@ -89,8 +89,8 @@ function f(p1: T, p2: T[]) { >p1 : T var o2 = { ...p2 }; // OK ->o2 : { [x: number]: T; length: number; toString(): string; toLocaleString(): string; push(...items: T[]): number; pop(): T; concat(...items: (T[] | ReadonlyArray)[]): T[]; concat(...items: (T | T[] | ReadonlyArray)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } ->{ ...p2 } : { [n: number]: T; length: number; toString(): string; toLocaleString(): string; push(...items: T[]): number; pop(): T; concat(...items: (T[] | ReadonlyArray)[]): T[]; concat(...items: (T | T[] | ReadonlyArray)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } +>o2 : { [x: number]: T; length: number; toString(): string; toLocaleString(): string; push(...items: T[]): number; pop(): T; concat(...items: ConcatArray[]): T[]; concat(...items: (T | ConcatArray)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } +>{ ...p2 } : { [n: number]: T; length: number; toString(): string; toLocaleString(): string; push(...items: T[]): number; pop(): T; concat(...items: ConcatArray[]): T[]; concat(...items: (T | ConcatArray)[]): T[]; join(separator?: string): string; reverse(): T[]; shift(): T; slice(start?: number, end?: number): T[]; sort(compareFn?: (a: T, b: T) => number): T[]; splice(start: number, deleteCount?: number): T[]; splice(start: number, deleteCount: number, ...items: T[]): T[]; unshift(...items: T[]): number; indexOf(searchElement: T, fromIndex?: number): number; lastIndexOf(searchElement: T, fromIndex?: number): number; every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; filter(callbackfn: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[]; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; } >p2 : T[] var o3 = { ...t }; // Error, generic type paramter diff --git a/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types index e4dc5df9449f9..56cded213453d 100644 --- a/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types +++ b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types @@ -348,9 +348,9 @@ class ListWrapper { >a : any[] >b : any[] >a.concat(b) : any[] ->a.concat : { (...items: (any[] | ReadonlyArray)[]): any[]; (...items: any[]): any[]; } +>a.concat : { (...items: ConcatArray[]): any[]; (...items: any[]): any[]; } >a : any[] ->concat : { (...items: (any[] | ReadonlyArray)[]): any[]; (...items: any[]): any[]; } +>concat : { (...items: ConcatArray[]): any[]; (...items: any[]): any[]; } >b : any[] static insert(dit: typeof ListWrapper, list: T[], index: number, value: T) { list.splice(index, 0, value); } diff --git a/tests/baselines/reference/underscoreTest1.types b/tests/baselines/reference/underscoreTest1.types index 8c6b2691e4ed6..2222de9e4120d 100644 --- a/tests/baselines/reference/underscoreTest1.types +++ b/tests/baselines/reference/underscoreTest1.types @@ -124,9 +124,9 @@ var flat = _.reduceRight(list, (a, b) => a.concat(b), []); >a : number[] >b : number[] >a.concat(b) : number[] ->a.concat : { (...items: (number[] | ReadonlyArray)[]): number[]; (...items: (number | number[] | ReadonlyArray)[]): number[]; } +>a.concat : { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; } >a : number[] ->concat : { (...items: (number[] | ReadonlyArray)[]): number[]; (...items: (number | number[] | ReadonlyArray)[]): number[]; } +>concat : { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; } >b : number[] >[] : undefined[] diff --git a/tests/cases/compiler/arrayConcat3.ts b/tests/cases/compiler/arrayConcat3.ts index d66d488a20d64..b0e4c4581ddad 100644 --- a/tests/cases/compiler/arrayConcat3.ts +++ b/tests/cases/compiler/arrayConcat3.ts @@ -1,3 +1,4 @@ +// @strictFunctionTypes: true // TODO: remove lib hack when https://github.com/Microsoft/TypeScript/issues/20454 is fixed type Fn = (subj: U) => U function doStuff(a: Array>, b: Array>) {