diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 3ca96f12760be..2690f5f10ffb1 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1272,27 +1272,27 @@ interface ReadonlyArray { * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T; + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U; /** * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U; + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T; /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T; + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U; /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U; + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T; readonly [n: number]: T; } @@ -1467,27 +1467,27 @@ interface Array { * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ - 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; /** * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + 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; /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ - 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; /** * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. */ - reduceRight(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; [n: number]: T; } diff --git a/src/lib/esnext.iterator.d.ts b/src/lib/esnext.iterator.d.ts index 860af153668e1..082241d53112e 100644 --- a/src/lib/esnext.iterator.d.ts +++ b/src/lib/esnext.iterator.d.ts @@ -66,15 +66,14 @@ declare global { * @param callbackfn A function that accepts up to three arguments. The reduce method calls the callbackfn function one time for each element in the iterator. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of a value from the iterator. */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T): T; - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T, initialValue: T): T; - + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number) => U, initialValue: U): U; /** * Calls the specified callback function for all the elements in this iterator. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. * @param callbackfn A function that accepts up to three arguments. The reduce method calls the callbackfn function one time for each element in the iterator. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of a value from the iterator. */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number) => U, initialValue: U): U; + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T): T; + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T, initialValue: T): T; /** * Creates a new array from the values yielded by this iterator. diff --git a/tests/baselines/reference/genericReduce.types b/tests/baselines/reference/genericReduce.types index 147a70473d2d4..1c4c141a17a05 100644 --- a/tests/baselines/reference/genericReduce.types +++ b/tests/baselines/reference/genericReduce.types @@ -42,12 +42,12 @@ var n1 = b.reduce((x, y) => x + y); > : ^^^^^^ >b.reduce((x, y) => x + y) : number > : ^^^^^^ ->b.reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; } -> : ^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ +>b.reduce : { (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; } +> : ^^^ ^^ ^^^ ^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ >b : number[] > : ^^^^^^^^ ->reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; } -> : ^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ +>reduce : { (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; } +> : ^^^ ^^ ^^^ ^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ >(x, y) => x + y : (x: number, y: number) => number > : ^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ >x : number @@ -66,12 +66,12 @@ var n2 = b.reduceRight((x, y) => x + y); > : ^^^^^^ >b.reduceRight((x, y) => x + y) : number > : ^^^^^^ ->b.reduceRight : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; } -> : ^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ +>b.reduceRight : { (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; } +> : ^^^ ^^ ^^^ ^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ >b : number[] > : ^^^^^^^^ ->reduceRight : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; } -> : ^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ +>reduceRight : { (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; } +> : ^^^ ^^ ^^^ ^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ >(x, y) => x + y : (x: number, y: number) => number > : ^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ >x : number @@ -138,12 +138,12 @@ var n3 = b.reduce( (x, y) => x + y, ""); // Initial value is of type str > : ^^^^^^ >b.reduce( (x, y) => x + y, "") : string > : ^^^^^^ ->b.reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; } -> : ^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ +>b.reduce : { (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; } +> : ^^^ ^^ ^^^ ^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ >b : number[] > : ^^^^^^^^ ->reduce : { (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; } -> : ^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ ^^ ^^^ ^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ +>reduce : { (callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: number[]) => U, initialValue: U): U; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number): number; (callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: number[]) => number, initialValue: number): number; } +> : ^^^ ^^ ^^^ ^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^ ^^ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ >(x, y) => x + y : (x: string, y: number) => string > : ^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ >x : string diff --git a/tests/baselines/reference/inferFromGenericFunctionReturnTypes1.types b/tests/baselines/reference/inferFromGenericFunctionReturnTypes1.types index b8a1afe03d68e..6f22874ba1b7e 100644 --- a/tests/baselines/reference/inferFromGenericFunctionReturnTypes1.types +++ b/tests/baselines/reference/inferFromGenericFunctionReturnTypes1.types @@ -142,12 +142,12 @@ function compose(...fns: ((x: T) => T)[]): (x: T) => T { > : ^ >fns.reduce((prev, fn) => fn(prev), x) : T > : ^ ->fns.reduce : { (callbackfn: (previousValue: (x: T) => T, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => (x: T) => T): (x: T) => T; (callbackfn: (previousValue: (x: T) => T, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => (x: T) => T, initialValue: (x: T) => T): (x: T) => T; (callbackfn: (previousValue: U, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => U, initialValue: U): U; } -> : ^^^ ^^^ ^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^ ^^ ^^^^^ ^^^^ ^^ ^^^^^ ^^^ ^^^ ^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^^^ ^^ ^^^^^ ^^^ ^^ ^^^ ^^^^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^ +>fns.reduce : { (callbackfn: (previousValue: U, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => U, initialValue: U): U; (callbackfn: (previousValue: (x: T) => T, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => (x: T) => T): (x: T) => T; (callbackfn: (previousValue: (x: T) => T, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => (x: T) => T, initialValue: (x: T) => T): (x: T) => T; } +> : ^^^ ^^ ^^^ ^^^^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^ ^^^ ^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^ ^^ ^^^^^ ^^^^ ^^ ^^^^^ ^^^ ^^^ ^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^^^ ^^ ^^^^^ ^^^ >fns : ((x: T) => T)[] > : ^^ ^^ ^^^^^ ^^^ ->reduce : { (callbackfn: (previousValue: (x: T) => T, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => (x: T) => T): (x: T) => T; (callbackfn: (previousValue: (x: T) => T, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => (x: T) => T, initialValue: (x: T) => T): (x: T) => T; (callbackfn: (previousValue: U, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => U, initialValue: U): U; } -> : ^^^ ^^^ ^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^ ^^ ^^^^^ ^^^^ ^^ ^^^^^ ^^^ ^^^ ^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^^^ ^^ ^^^^^ ^^^ ^^ ^^^ ^^^^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^ +>reduce : { (callbackfn: (previousValue: U, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => U, initialValue: U): U; (callbackfn: (previousValue: (x: T) => T, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => (x: T) => T): (x: T) => T; (callbackfn: (previousValue: (x: T) => T, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => (x: T) => T, initialValue: (x: T) => T): (x: T) => T; } +> : ^^^ ^^ ^^^ ^^^^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^ ^^^ ^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^ ^^ ^^^^^ ^^^^ ^^ ^^^^^ ^^^ ^^^ ^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^^^ ^^ ^^^^^ ^^^ >(prev, fn) => fn(prev) : (prev: T, fn: (x: T) => T) => T > : ^ ^^^^^ ^^^ ^^ ^^^^^ ^^^^^^ >prev : T diff --git a/tests/baselines/reference/inferFromGenericFunctionReturnTypes2.types b/tests/baselines/reference/inferFromGenericFunctionReturnTypes2.types index 0524f0f522e81..b11e5b977583c 100644 --- a/tests/baselines/reference/inferFromGenericFunctionReturnTypes2.types +++ b/tests/baselines/reference/inferFromGenericFunctionReturnTypes2.types @@ -498,12 +498,12 @@ function compose(...fns: ((x: T) => T)[]): (x: T) => T { > : ^ >fns.reduce((prev, fn) => fn(prev), x) : T > : ^ ->fns.reduce : { (callbackfn: (previousValue: (x: T) => T, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => (x: T) => T): (x: T) => T; (callbackfn: (previousValue: (x: T) => T, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => (x: T) => T, initialValue: (x: T) => T): (x: T) => T; (callbackfn: (previousValue: U, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => U, initialValue: U): U; } -> : ^^^ ^^^ ^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^ ^^ ^^^^^ ^^^^ ^^ ^^^^^ ^^^ ^^^ ^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^^^ ^^ ^^^^^ ^^^ ^^ ^^^ ^^^^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^ +>fns.reduce : { (callbackfn: (previousValue: U, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => U, initialValue: U): U; (callbackfn: (previousValue: (x: T) => T, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => (x: T) => T): (x: T) => T; (callbackfn: (previousValue: (x: T) => T, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => (x: T) => T, initialValue: (x: T) => T): (x: T) => T; } +> : ^^^ ^^ ^^^ ^^^^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^ ^^^ ^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^ ^^ ^^^^^ ^^^^ ^^ ^^^^^ ^^^ ^^^ ^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^^^ ^^ ^^^^^ ^^^ >fns : ((x: T) => T)[] > : ^^ ^^ ^^^^^ ^^^ ->reduce : { (callbackfn: (previousValue: (x: T) => T, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => (x: T) => T): (x: T) => T; (callbackfn: (previousValue: (x: T) => T, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => (x: T) => T, initialValue: (x: T) => T): (x: T) => T; (callbackfn: (previousValue: U, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => U, initialValue: U): U; } -> : ^^^ ^^^ ^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^ ^^ ^^^^^ ^^^^ ^^ ^^^^^ ^^^ ^^^ ^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^^^ ^^ ^^^^^ ^^^ ^^ ^^^ ^^^^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^ +>reduce : { (callbackfn: (previousValue: U, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => U, initialValue: U): U; (callbackfn: (previousValue: (x: T) => T, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => (x: T) => T): (x: T) => T; (callbackfn: (previousValue: (x: T) => T, currentValue: (x: T) => T, currentIndex: number, array: ((x: T) => T)[]) => (x: T) => T, initialValue: (x: T) => T): (x: T) => T; } +> : ^^^ ^^ ^^^ ^^^^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^ ^^^ ^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^ ^^ ^^^^^ ^^^^ ^^ ^^^^^ ^^^ ^^^ ^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^ ^^ ^^ ^^^^ ^^ ^^^^^ ^^^^^^^^^ ^^ ^^^^^ ^^ ^^^ ^^ ^^^^^ ^^^^ ^^ ^^^^^ ^^^ >(prev, fn) => fn(prev) : (prev: T, fn: (x: T) => T) => T > : ^ ^^^^^ ^^^ ^^ ^^^^^ ^^^^^^ >prev : T