diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index c8e99f0d1dbaf..e6e05945fa70d 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1070,7 +1070,7 @@ interface ReadonlyArray { * Combines two or more arrays. * @param items Additional items to add to the end of array1. */ - concat(...items: ConcatArray[]): T[]; + concat(...items: (ConcatArray | ConcatArray)[]): (T | U)[]; /** * Combines two or more arrays. * @param items Additional items to add to the end of array1. @@ -1198,7 +1198,7 @@ interface Array { * Combines two or more arrays. * @param items Additional items to add to the end of array1. */ - concat(...items: ConcatArray[]): T[]; + concat(...items: (ConcatArray | ConcatArray)[]): (T | U)[]; /** * Combines two or more arrays. * @param items Additional items to add to the end of array1. diff --git a/tests/baselines/reference/arrayConcat2.types b/tests/baselines/reference/arrayConcat2.types index f1ca2a5f10977..c35b2c490bf1b 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: ConcatArray[]): string[]; (...items: (string | ConcatArray)[]): string[]; } +>a.concat : { (...items: (ConcatArray | ConcatArray)[]): (string | U)[]; (...items: (string | ConcatArray)[]): string[]; } >a : string[] ->concat : { (...items: ConcatArray[]): string[]; (...items: (string | ConcatArray)[]): string[]; } +>concat : { (...items: (ConcatArray | ConcatArray)[]): (string | U)[]; (...items: (string | ConcatArray)[]): string[]; } >"hello" : "hello" >'world' : "world" a.concat('Hello'); >a.concat('Hello') : string[] ->a.concat : { (...items: ConcatArray[]): string[]; (...items: (string | ConcatArray)[]): string[]; } +>a.concat : { (...items: (ConcatArray | ConcatArray)[]): (string | U)[]; (...items: (string | ConcatArray)[]): string[]; } >a : string[] ->concat : { (...items: ConcatArray[]): string[]; (...items: (string | ConcatArray)[]): string[]; } +>concat : { (...items: (ConcatArray | ConcatArray)[]): (string | U)[]; (...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: ConcatArray[]): string[]; (...items: (string | ConcatArray)[]): string[]; } +>b.concat : { (...items: (ConcatArray | ConcatArray)[]): (string | U)[]; (...items: (string | ConcatArray)[]): string[]; } >b : string[] ->concat : { (...items: ConcatArray[]): string[]; (...items: (string | ConcatArray)[]): string[]; } +>concat : { (...items: (ConcatArray | ConcatArray)[]): (string | U)[]; (...items: (string | ConcatArray)[]): string[]; } >'hello' : "hello" diff --git a/tests/baselines/reference/arrayConcat3.types b/tests/baselines/reference/arrayConcat3.types index 8bfe636a97192..6ff504fd39add 100644 --- a/tests/baselines/reference/arrayConcat3.types +++ b/tests/baselines/reference/arrayConcat3.types @@ -10,10 +10,10 @@ function doStuff(a: Array>, b: Arrayb : Fn[] b.concat(a); ->b.concat(a) : Fn[] ->b.concat : { (...items: ConcatArray>[]): Fn[]; (...items: (Fn | ConcatArray>)[]): Fn[]; } +>b.concat(a) : (Fn | Fn)[] +>b.concat : { (...items: (ConcatArray> | ConcatArray)[]): (Fn | U)[]; (...items: (Fn | ConcatArray>)[]): Fn[]; } >b : Fn[] ->concat : { (...items: ConcatArray>[]): Fn[]; (...items: (Fn | ConcatArray>)[]): Fn[]; } +>concat : { (...items: (ConcatArray> | ConcatArray)[]): (Fn | U)[]; (...items: (Fn | ConcatArray>)[]): Fn[]; } >a : Fn[] } diff --git a/tests/baselines/reference/arrayConcatMap.types b/tests/baselines/reference/arrayConcatMap.types index ffc49e548a350..4e3bd2ef29d12 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: ConcatArray[]): any[]; (...items: any[]): any[]; } +>[].concat : { (...items: (ConcatArray | ConcatArray)[]): any[]; (...items: any[]): any[]; } >[] : undefined[] ->concat : { (...items: ConcatArray[]): any[]; (...items: any[]): any[]; } +>concat : { (...items: (ConcatArray | 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 66a659b386339..c90fc3a15a15f 100644 --- a/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt +++ b/tests/baselines/reference/arrayOfSubtypeIsAssignableToReadonlyArray.errors.txt @@ -3,9 +3,12 @@ tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts(13,1): error T 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: 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'. + Type '{ (...items: (ConcatArray | ConcatArray)[]): (A | U)[]; (...items: (A | ConcatArray)[]): A[]; }' is not assignable to type '{ (...items: (ConcatArray | ConcatArray)[]): (B | U)[]; (...items: (B | ConcatArray)[]): B[]; }'. + Types of parameters 'items' and 'items' are incompatible. + Type 'B | ConcatArray' is not assignable to type 'ConcatArray | ConcatArray'. + Type 'B' is not assignable to type 'ConcatArray | ConcatArray'. + Type 'B' is not assignable to type 'ConcatArray'. + Property 'length' is missing in type 'B'. ==== tests/cases/compiler/arrayOfSubtypeIsAssignableToReadonlyArray.ts (2 errors) ==== @@ -34,7 +37,10 @@ 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: 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: Type '{ (...items: (ConcatArray | ConcatArray)[]): (A | U)[]; (...items: (A | ConcatArray)[]): A[]; }' is not assignable to type '{ (...items: (ConcatArray | ConcatArray)[]): (B | U)[]; (...items: (B | ConcatArray)[]): B[]; }'. +!!! error TS2322: Types of parameters 'items' and 'items' are incompatible. +!!! error TS2322: Type 'B | ConcatArray' is not assignable to type 'ConcatArray | ConcatArray'. +!!! error TS2322: Type 'B' is not assignable to type 'ConcatArray | ConcatArray'. +!!! error TS2322: Type 'B' is not assignable to type 'ConcatArray'. +!!! error TS2322: Property 'length' is missing in type 'B'. \ No newline at end of file diff --git a/tests/baselines/reference/concatError.types b/tests/baselines/reference/concatError.types index 52f413b20b6b4..b1eef807e7cbb 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: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; } +>fa.concat : { (...items: (ConcatArray | ConcatArray)[]): (number | U)[]; (...items: (number | ConcatArray)[]): number[]; } >fa : number[] ->concat : { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; } +>concat : { (...items: (ConcatArray | ConcatArray)[]): (number | U)[]; (...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: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; } +>fa.concat : { (...items: (ConcatArray | ConcatArray)[]): (number | U)[]; (...items: (number | ConcatArray)[]): number[]; } >fa : number[] ->concat : { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; } +>concat : { (...items: (ConcatArray | ConcatArray)[]): (number | U)[]; (...items: (number | ConcatArray)[]): number[]; } >0 : 0 diff --git a/tests/baselines/reference/concatTuples.types b/tests/baselines/reference/concatTuples.types index d85ee92557041..1aee667eb5e46 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: ConcatArray<[number, number]>[]): [number, number][]; (...items: ([number, number] | ConcatArray<[number, number]>)[]): [number, number][]; } +>ijs.concat : { (...items: (ConcatArray<[number, number]> | ConcatArray)[]): ([number, number] | U)[]; (...items: ([number, number] | ConcatArray<[number, number]>)[]): [number, number][]; } >ijs : [number, number][] ->concat : { (...items: ConcatArray<[number, number]>[]): [number, number][]; (...items: ([number, number] | ConcatArray<[number, number]>)[]): [number, number][]; } +>concat : { (...items: (ConcatArray<[number, number]> | ConcatArray)[]): ([number, number] | U)[]; (...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/contextualExpressionTypecheckingDoesntBlowStack.types b/tests/baselines/reference/contextualExpressionTypecheckingDoesntBlowStack.types index 8d462f4dbd912..6de5ac5ab4721 100644 --- a/tests/baselines/reference/contextualExpressionTypecheckingDoesntBlowStack.types +++ b/tests/baselines/reference/contextualExpressionTypecheckingDoesntBlowStack.types @@ -72,12 +72,12 @@ export default class Operation { >result = (result || []).concat(innerResult) : IValidationError[] >result : IValidationError[] | null >(result || []).concat(innerResult) : IValidationError[] ->(result || []).concat : { (...items: ConcatArray[]): IValidationError[]; (...items: (IValidationError | ConcatArray)[]): IValidationError[]; } +>(result || []).concat : { (...items: (ConcatArray | ConcatArray)[]): (IValidationError | U)[]; (...items: (IValidationError | ConcatArray)[]): IValidationError[]; } >(result || []) : IValidationError[] >result || [] : IValidationError[] >result : IValidationError[] | null >[] : never[] ->concat : { (...items: ConcatArray[]): IValidationError[]; (...items: (IValidationError | ConcatArray)[]): IValidationError[]; } +>concat : { (...items: (ConcatArray | ConcatArray)[]): (IValidationError | U)[]; (...items: (IValidationError | ConcatArray)[]): IValidationError[]; } >innerResult : any } } diff --git a/tests/baselines/reference/emitSkipsThisWithRestParameter.types b/tests/baselines/reference/emitSkipsThisWithRestParameter.types index 9aa0e1fa55b66..3a9c08ae56513 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: ConcatArray[]): any[]; (...items: any[]): any[]; } +>[ this ].concat : { (...items: (ConcatArray | ConcatArray)[]): any[]; (...items: any[]): any[]; } >[ this ] : any[] >this : any ->concat : { (...items: ConcatArray[]): any[]; (...items: any[]): any[]; } +>concat : { (...items: (ConcatArray | ConcatArray)[]): any[]; (...items: any[]): any[]; } >args : any[] }; diff --git a/tests/baselines/reference/intersectionTypeInference3.types b/tests/baselines/reference/intersectionTypeInference3.types index ac8fc2ccbc038..4b2657b375aa5 100644 --- a/tests/baselines/reference/intersectionTypeInference3.types +++ b/tests/baselines/reference/intersectionTypeInference3.types @@ -24,13 +24,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: ConcatArray>[]): Nominal<"A", string>[]; (...items: (Nominal<"A", string> | ConcatArray>)[]): Nominal<"A", string>[]; } +>Array.from(a).concat : { (...items: (ConcatArray> | ConcatArray)[]): (Nominal<"A", string> | U)[]; (...items: (Nominal<"A", string> | ConcatArray>)[]): Nominal<"A", string>[]; } >Array.from(a) : Nominal<"A", string>[] >Array.from : { (arrayLike: ArrayLike): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable | ArrayLike): T[]; (iterable: Iterable | ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; } >Array : ArrayConstructor >from : { (arrayLike: ArrayLike): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable | ArrayLike): T[]; (iterable: Iterable | ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; } >a : Set> ->concat : { (...items: ConcatArray>[]): Nominal<"A", string>[]; (...items: (Nominal<"A", string> | ConcatArray>)[]): Nominal<"A", string>[]; } +>concat : { (...items: (ConcatArray> | ConcatArray)[]): (Nominal<"A", string> | U)[]; (...items: (Nominal<"A", string> | ConcatArray>)[]): Nominal<"A", string>[]; } >Array.from(b) : Nominal<"A", string>[] >Array.from : { (arrayLike: ArrayLike): T[]; (arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; (iterable: Iterable | ArrayLike): T[]; (iterable: Iterable | 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 deleted file mode 100644 index 4f547c59ed045..0000000000000 --- a/tests/baselines/reference/iteratorSpreadInArray6.errors.txt +++ /dev/null @@ -1,31 +0,0 @@ -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) ==== - class SymbolIterator { - next() { - return { - value: Symbol(), - done: false - }; - } - - [Symbol.iterator]() { - return this; - } - } - - var array: number[] = [0, 1]; - array.concat([...new SymbolIterator]); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! 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 b964fdbca1304..3fbfe8f7c040e 100644 --- a/tests/baselines/reference/iteratorSpreadInArray6.types +++ b/tests/baselines/reference/iteratorSpreadInArray6.types @@ -38,10 +38,10 @@ var array: number[] = [0, 1]; >1 : 1 array.concat([...new SymbolIterator]); ->array.concat([...new SymbolIterator]) : any ->array.concat : { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; } +>array.concat([...new SymbolIterator]) : (number | symbol)[] +>array.concat : { (...items: (ConcatArray | ConcatArray)[]): (number | U)[]; (...items: (number | ConcatArray)[]): number[]; } >array : number[] ->concat : { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; } +>concat : { (...items: (ConcatArray | ConcatArray)[]): (number | U)[]; (...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 9d3cf2cfa7ed6..3d23d32c2205e 100644 --- a/tests/baselines/reference/iteratorSpreadInArray7.types +++ b/tests/baselines/reference/iteratorSpreadInArray7.types @@ -36,9 +36,9 @@ var array: symbol[]; array.concat([...new SymbolIterator]); >array.concat([...new SymbolIterator]) : symbol[] ->array.concat : { (...items: ConcatArray[]): symbol[]; (...items: (symbol | ConcatArray)[]): symbol[]; } +>array.concat : { (...items: (ConcatArray | ConcatArray)[]): (symbol | U)[]; (...items: (symbol | ConcatArray)[]): symbol[]; } >array : symbol[] ->concat : { (...items: ConcatArray[]): symbol[]; (...items: (symbol | ConcatArray)[]): symbol[]; } +>concat : { (...items: (ConcatArray | ConcatArray)[]): (symbol | U)[]; (...items: (symbol | ConcatArray)[]): symbol[]; } >[...new SymbolIterator] : symbol[] >...new SymbolIterator : symbol >new SymbolIterator : SymbolIterator diff --git a/tests/baselines/reference/mappedTypesArraysTuples.types b/tests/baselines/reference/mappedTypesArraysTuples.types index df99246e9bd27..ab855515a272f 100644 --- a/tests/baselines/reference/mappedTypesArraysTuples.types +++ b/tests/baselines/reference/mappedTypesArraysTuples.types @@ -196,9 +196,9 @@ function f2(a: Boxified) { let y: Box[] = a.concat(a); >y : Box[] >a.concat(a) : Box[] ->a.concat : { (...items: ConcatArray>[]): Box[]; (...items: (Box | ConcatArray>)[]): Box[]; } +>a.concat : { (...items: (ConcatArray> | ConcatArray)[]): (Box | U)[]; (...items: (Box | ConcatArray>)[]): Box[]; } >a : Boxified ->concat : { (...items: ConcatArray>[]): Box[]; (...items: (Box | ConcatArray>)[]): Box[]; } +>concat : { (...items: (ConcatArray> | ConcatArray)[]): (Box | U)[]; (...items: (Box | ConcatArray>)[]): Box[]; } >a : Boxified } diff --git a/tests/baselines/reference/parserRealSource4.types b/tests/baselines/reference/parserRealSource4.types index f46c6835aaad6..636bbc73692ea 100644 --- a/tests/baselines/reference/parserRealSource4.types +++ b/tests/baselines/reference/parserRealSource4.types @@ -418,14 +418,14 @@ module TypeScript { return this.primaryTable.getAllKeys().concat(this.secondaryTable.getAllKeys()); >this.primaryTable.getAllKeys().concat(this.secondaryTable.getAllKeys()) : string[] ->this.primaryTable.getAllKeys().concat : { (...items: ConcatArray[]): string[]; (...items: (string | ConcatArray)[]): string[]; } +>this.primaryTable.getAllKeys().concat : { (...items: (ConcatArray | ConcatArray)[]): (string | U)[]; (...items: (string | ConcatArray)[]): string[]; } >this.primaryTable.getAllKeys() : string[] >this.primaryTable.getAllKeys : () => string[] >this.primaryTable : IHashTable >this : this >primaryTable : IHashTable >getAllKeys : () => string[] ->concat : { (...items: ConcatArray[]): string[]; (...items: (string | ConcatArray)[]): string[]; } +>concat : { (...items: (ConcatArray | ConcatArray)[]): (string | U)[]; (...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 222ac9ab94559..0c6704ab2b981 100644 --- a/tests/baselines/reference/parserharness.types +++ b/tests/baselines/reference/parserharness.types @@ -4775,9 +4775,9 @@ module Harness { >lines = lines.concat(v.file.lines) : any[] >lines : any[] >lines.concat(v.file.lines) : any[] ->lines.concat : { (...items: ConcatArray[]): any[]; (...items: any[]): any[]; } +>lines.concat : { (...items: (ConcatArray | ConcatArray)[]): any[]; (...items: any[]): any[]; } >lines : any[] ->concat : { (...items: ConcatArray[]): any[]; (...items: any[]): any[]; } +>concat : { (...items: (ConcatArray | 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 ce59fb145f960..2e642f1d91649 100644 --- a/tests/baselines/reference/restInvalidArgumentType.types +++ b/tests/baselines/reference/restInvalidArgumentType.types @@ -71,7 +71,7 @@ function f(p1: T, p2: T[]) { >p1 : T var {...r2} = p2; // OK ->r2 : { [n: number]: T; length: number; toString(): string; toLocaleString(): string; pop(): T; push(...items: T[]): number; 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; } +>r2 : { [n: number]: T; length: number; toString(): string; toLocaleString(): string; pop(): T; push(...items: T[]): number; concat(...items: (ConcatArray | ConcatArray)[]): (T | U)[]; 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 1acb22419a9cf..d70469ba1d454 100644 --- a/tests/baselines/reference/spreadInvalidArgumentType.types +++ b/tests/baselines/reference/spreadInvalidArgumentType.types @@ -73,8 +73,8 @@ function f(p1: T, p2: T[]) { >p1 : T var o2 = { ...p2 }; // OK ->o2 : { [x: number]: T; length: number; toString(): string; toLocaleString(): string; pop(): T; push(...items: T[]): number; 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; pop(): T; push(...items: T[]): number; 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; } +>o2 : { [x: number]: T; length: number; toString(): string; toLocaleString(): string; pop(): T; push(...items: T[]): number; concat(...items: (ConcatArray | ConcatArray)[]): (T | U)[]; 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; pop(): T; push(...items: T[]): number; concat(...items: (ConcatArray | ConcatArray)[]): (T | U)[]; 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 382c14fb22b6b..a78a738d13149 100644 --- a/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types +++ b/tests/baselines/reference/staticAnonymousTypeNotReferencingTypeParameter.types @@ -306,9 +306,9 @@ class ListWrapper { >a : any[] >b : any[] >a.concat(b) : any[] ->a.concat : { (...items: ConcatArray[]): any[]; (...items: any[]): any[]; } +>a.concat : { (...items: (ConcatArray | ConcatArray)[]): any[]; (...items: any[]): any[]; } >a : any[] ->concat : { (...items: ConcatArray[]): any[]; (...items: any[]): any[]; } +>concat : { (...items: (ConcatArray | 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 c247c40cd1d89..8bf4a5f803c4c 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: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; } +>a.concat : { (...items: (ConcatArray | ConcatArray)[]): (number | U)[]; (...items: (number | ConcatArray)[]): number[]; } >a : number[] ->concat : { (...items: ConcatArray[]): number[]; (...items: (number | ConcatArray)[]): number[]; } +>concat : { (...items: (ConcatArray | ConcatArray)[]): (number | U)[]; (...items: (number | ConcatArray)[]): number[]; } >b : number[] >[] : undefined[]