diff --git a/tests/baselines/reference/genericFunctionInference1.errors.txt b/tests/baselines/reference/genericFunctionInference1.errors.txt new file mode 100644 index 00000000000..9b082d39ab2 --- /dev/null +++ b/tests/baselines/reference/genericFunctionInference1.errors.txt @@ -0,0 +1,193 @@ +tests/cases/compiler/genericFunctionInference1.ts(83,14): error TS2345: Argument of type '(value: { key: a; }) => a' is not assignable to parameter of type '(value: Data) => string'. + Type 'number' is not assignable to type 'string'. + + +==== tests/cases/compiler/genericFunctionInference1.ts (1 errors) ==== + declare function pipe(ab: (...args: A) => B): (...args: A) => B; + declare function pipe(ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; + declare function pipe(ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; + + declare function list(a: T): T[]; + declare function box(x: V): { value: V }; + declare function foo(x: T): T; + + const f00 = pipe(list); + const f01 = pipe(list, box); + const f02 = pipe(box, list); + const f03 = pipe(x => list(x), box); + const f04 = pipe(list, x => box(x)); + const f05 = pipe(x => list(x), x => box(x)) + const f06 = pipe(list, pipe(box)); + const f07 = pipe(x => list(x), pipe(box)); + const f08 = pipe(x => list(x), pipe(x => box(x))); + const f09 = pipe(list, x => x.length); + const f10 = pipe(foo); + const f11 = pipe(foo, foo); + + const g00: (x: T) => T[] = pipe(list); + const g01: (x: T) => { value: T[] } = pipe(list, box); + const g02: (x: T) => { value: T }[] = pipe(box, list); + const g03: (x: T) => { value: T[] } = pipe(x => list(x), box); + const g04: (x: T) => { value: T[] } = pipe(list, x => box(x)); + const g05: (x: T) => { value: T[] } = pipe(x => list(x), x => box(x)) + const g06: (x: T) => { value: T[] } = pipe(list, pipe(box)); + const g07: (x: T) => { value: T[] } = pipe(x => list(x), pipe(box)); + const g08: (x: T) => { value: T[] } = pipe(x => list(x), pipe(x => box(x))); + const g09: (x: T) => number = pipe(list, x => x.length); + const g10: (x: T) => T = pipe(foo); + const g12: (x: T) => T = pipe(foo, foo); + + declare function pipe2(ab: (a: A) => B, cd: (c: C) => D): (a: [A, C]) => [B, D]; + + const f20 = pipe2(list, box); + const f21 = pipe2(box, list); + const f22 = pipe2(list, list); + const f23 = pipe2(box, box); + const f24 = pipe2(f20, f20); + const f25 = pipe2(foo, foo); + const f26 = pipe2(f25, f25); + + declare function pipe3(ab: (a: A) => B, ac: (a: A) => C): (a: A) => [B, C]; + + const f30 = pipe3(list, box); + const f31 = pipe3(box, list); + const f32 = pipe3(list, list); + + declare function pipe4(funcs: [(a: A) => B, (b: B) => C]): (a: A) => C; + + const f40 = pipe4([list, box]); + const f41 = pipe4([box, list]); + + declare function pipe5(f: (a: A) => B): { f: (a: A) => B }; + + const f50 = pipe5(list); // No higher order inference + + // #417 + + function mirror(f: (a: A) => B): (a: A) => B { return f; } + var identityM = mirror(identity); + + var x = 1; + var y = identity(x); + var z = identityM(x); + + // #3038 + + export function keyOf(value: { key: a; }): a { + return value.key; + } + export interface Data { + key: number; + value: Date; + } + + var data: Data[] = []; + + declare function toKeys(values: a[], toKey: (value: a) => string): string[]; + + toKeys(data, keyOf); // Error + ~~~~~ +!!! error TS2345: Argument of type '(value: { key: a; }) => a' is not assignable to parameter of type '(value: Data) => string'. +!!! error TS2345: Type 'number' is not assignable to type 'string'. + + // #9366 + + function flip(f: (a: a, b: b) => c): (b: b, a: a) => c { + return (b: b, a: a) => f(a, b); + } + function zip(x: T, y: U): [T, U] { + return [x, y]; + } + + var expected: (y: U, x: T) => [T, U] = flip(zip); + var actual = flip(zip); + + // #9366 + + const map = (transform: (t: T) => U) => + (arr: T[]) => arr.map(transform) + + const identityStr = (t: string) => t; + + const arr: string[] = map(identityStr)(['a']); + const arr1: string[] = map(identity)(['a']); + + // #9949 + + function of2(one: a, two: b): [a, b] { + return [one, two]; + } + + const flipped = flip(of2); + + // #29904.1 + + type Component

= (props: P) => {}; + + declare const myHoc1:

(C: Component

) => Component

; + declare const myHoc2:

(C: Component

) => Component

; + + declare const MyComponent1: Component<{ foo: 1 }>; + + const enhance = pipe( + myHoc1, + myHoc2, + ); + + const MyComponent2 = enhance(MyComponent1); + + // #29904.2 + + const fn20 = pipe((_a?: {}) => 1); + + // #29904.3 + + type Fn = (n: number) => number; + const fn30: Fn = pipe( + x => x + 1, + x => x * 2, + ); + + const promise = Promise.resolve(1); + promise.then( + pipe( + x => x + 1, + x => x * 2, + ), + ); + + // #29904.4 + + declare const getString: () => string; + declare const orUndefined: (name: string) => string | undefined; + declare const identity: (value: T) => T; + + const fn40 = pipe( + getString, + string => orUndefined(string), + identity, + ); + + // #29904.6 + + declare const getArray: () => string[]; + declare const first: (ts: T[]) => T; + + const fn60 = pipe( + getArray, + x => x, + first, + ); + + const fn61 = pipe( + getArray, + identity, + first, + ); + + const fn62 = pipe( + getArray, + x => x, + x => first(x), + ); + \ No newline at end of file diff --git a/tests/baselines/reference/genericFunctionInference1.js b/tests/baselines/reference/genericFunctionInference1.js index 872656ba9c5..4e89f9c0795 100644 --- a/tests/baselines/reference/genericFunctionInference1.js +++ b/tests/baselines/reference/genericFunctionInference1.js @@ -5,24 +5,129 @@ declare function pipe(ab: (...args: A) => B, bc: (b: B declare function list(a: T): T[]; declare function box(x: V): { value: V }; +declare function foo(x: T): T; const f00 = pipe(list); const f01 = pipe(list, box); -const f02 = pipe(x => list(x), box); -const f03 = pipe(list, x => box(x)); -const f04 = pipe(x => list(x), x => box(x)) -const f05 = pipe(list, pipe(box)); -const f06 = pipe(x => list(x), pipe(box)); -const f07 = pipe(x => list(x), pipe(x => box(x))); +const f02 = pipe(box, list); +const f03 = pipe(x => list(x), box); +const f04 = pipe(list, x => box(x)); +const f05 = pipe(x => list(x), x => box(x)) +const f06 = pipe(list, pipe(box)); +const f07 = pipe(x => list(x), pipe(box)); +const f08 = pipe(x => list(x), pipe(x => box(x))); +const f09 = pipe(list, x => x.length); +const f10 = pipe(foo); +const f11 = pipe(foo, foo); -const f10: (x: T) => T[] = pipe(list); -const f11: (x: T) => { value: T[] } = pipe(list, box); -const f12: (x: T) => { value: T[] } = pipe(x => list(x), box); -const f13: (x: T) => { value: T[] } = pipe(list, x => box(x)); -const f14: (x: T) => { value: T[] } = pipe(x => list(x), x => box(x)) -const f15: (x: T) => { value: T[] } = pipe(list, pipe(box)); -const f16: (x: T) => { value: T[] } = pipe(x => list(x), pipe(box)); -const f17: (x: T) => { value: T[] } = pipe(x => list(x), pipe(x => box(x))); +const g00: (x: T) => T[] = pipe(list); +const g01: (x: T) => { value: T[] } = pipe(list, box); +const g02: (x: T) => { value: T }[] = pipe(box, list); +const g03: (x: T) => { value: T[] } = pipe(x => list(x), box); +const g04: (x: T) => { value: T[] } = pipe(list, x => box(x)); +const g05: (x: T) => { value: T[] } = pipe(x => list(x), x => box(x)) +const g06: (x: T) => { value: T[] } = pipe(list, pipe(box)); +const g07: (x: T) => { value: T[] } = pipe(x => list(x), pipe(box)); +const g08: (x: T) => { value: T[] } = pipe(x => list(x), pipe(x => box(x))); +const g09: (x: T) => number = pipe(list, x => x.length); +const g10: (x: T) => T = pipe(foo); +const g12: (x: T) => T = pipe(foo, foo); + +declare function pipe2(ab: (a: A) => B, cd: (c: C) => D): (a: [A, C]) => [B, D]; + +const f20 = pipe2(list, box); +const f21 = pipe2(box, list); +const f22 = pipe2(list, list); +const f23 = pipe2(box, box); +const f24 = pipe2(f20, f20); +const f25 = pipe2(foo, foo); +const f26 = pipe2(f25, f25); + +declare function pipe3(ab: (a: A) => B, ac: (a: A) => C): (a: A) => [B, C]; + +const f30 = pipe3(list, box); +const f31 = pipe3(box, list); +const f32 = pipe3(list, list); + +declare function pipe4(funcs: [(a: A) => B, (b: B) => C]): (a: A) => C; + +const f40 = pipe4([list, box]); +const f41 = pipe4([box, list]); + +declare function pipe5(f: (a: A) => B): { f: (a: A) => B }; + +const f50 = pipe5(list); // No higher order inference + +// #417 + +function mirror(f: (a: A) => B): (a: A) => B { return f; } +var identityM = mirror(identity); + +var x = 1; +var y = identity(x); +var z = identityM(x); + +// #3038 + +export function keyOf(value: { key: a; }): a { + return value.key; +} +export interface Data { + key: number; + value: Date; +} + +var data: Data[] = []; + +declare function toKeys(values: a[], toKey: (value: a) => string): string[]; + +toKeys(data, keyOf); // Error + +// #9366 + +function flip(f: (a: a, b: b) => c): (b: b, a: a) => c { + return (b: b, a: a) => f(a, b); +} +function zip(x: T, y: U): [T, U] { + return [x, y]; +} + +var expected: (y: U, x: T) => [T, U] = flip(zip); +var actual = flip(zip); + +// #9366 + +const map = (transform: (t: T) => U) => + (arr: T[]) => arr.map(transform) + +const identityStr = (t: string) => t; + +const arr: string[] = map(identityStr)(['a']); +const arr1: string[] = map(identity)(['a']); + +// #9949 + +function of2(one: a, two: b): [a, b] { + return [one, two]; +} + +const flipped = flip(of2); + +// #29904.1 + +type Component

= (props: P) => {}; + +declare const myHoc1:

(C: Component

) => Component

; +declare const myHoc2:

(C: Component

) => Component

; + +declare const MyComponent1: Component<{ foo: 1 }>; + +const enhance = pipe( + myHoc1, + myHoc2, +); + +const MyComponent2 = enhance(MyComponent1); // #29904.2 @@ -81,23 +186,76 @@ const fn62 = pipe( //// [genericFunctionInference1.js] -"use strict"; const f00 = pipe(list); const f01 = pipe(list, box); -const f02 = pipe(x => list(x), box); -const f03 = pipe(list, x => box(x)); -const f04 = pipe(x => list(x), x => box(x)); -const f05 = pipe(list, pipe(box)); -const f06 = pipe(x => list(x), pipe(box)); -const f07 = pipe(x => list(x), pipe(x => box(x))); -const f10 = pipe(list); -const f11 = pipe(list, box); -const f12 = pipe(x => list(x), box); -const f13 = pipe(list, x => box(x)); -const f14 = pipe(x => list(x), x => box(x)); -const f15 = pipe(list, pipe(box)); -const f16 = pipe(x => list(x), pipe(box)); -const f17 = pipe(x => list(x), pipe(x => box(x))); +const f02 = pipe(box, list); +const f03 = pipe(x => list(x), box); +const f04 = pipe(list, x => box(x)); +const f05 = pipe(x => list(x), x => box(x)); +const f06 = pipe(list, pipe(box)); +const f07 = pipe(x => list(x), pipe(box)); +const f08 = pipe(x => list(x), pipe(x => box(x))); +const f09 = pipe(list, x => x.length); +const f10 = pipe(foo); +const f11 = pipe(foo, foo); +const g00 = pipe(list); +const g01 = pipe(list, box); +const g02 = pipe(box, list); +const g03 = pipe(x => list(x), box); +const g04 = pipe(list, x => box(x)); +const g05 = pipe(x => list(x), x => box(x)); +const g06 = pipe(list, pipe(box)); +const g07 = pipe(x => list(x), pipe(box)); +const g08 = pipe(x => list(x), pipe(x => box(x))); +const g09 = pipe(list, x => x.length); +const g10 = pipe(foo); +const g12 = pipe(foo, foo); +const f20 = pipe2(list, box); +const f21 = pipe2(box, list); +const f22 = pipe2(list, list); +const f23 = pipe2(box, box); +const f24 = pipe2(f20, f20); +const f25 = pipe2(foo, foo); +const f26 = pipe2(f25, f25); +const f30 = pipe3(list, box); +const f31 = pipe3(box, list); +const f32 = pipe3(list, list); +const f40 = pipe4([list, box]); +const f41 = pipe4([box, list]); +const f50 = pipe5(list); // No higher order inference +// #417 +function mirror(f) { return f; } +var identityM = mirror(identity); +var x = 1; +var y = identity(x); +var z = identityM(x); +// #3038 +export function keyOf(value) { + return value.key; +} +var data = []; +toKeys(data, keyOf); // Error +// #9366 +function flip(f) { + return (b, a) => f(a, b); +} +function zip(x, y) { + return [x, y]; +} +var expected = flip(zip); +var actual = flip(zip); +// #9366 +const map = (transform) => (arr) => arr.map(transform); +const identityStr = (t) => t; +const arr = map(identityStr)(['a']); +const arr1 = map(identity)(['a']); +// #9949 +function of2(one, two) { + return [one, two]; +} +const flipped = flip(of2); +const enhance = pipe(myHoc1, myHoc2); +const MyComponent2 = enhance(MyComponent1); // #29904.2 const fn20 = pipe((_a) => 1); const fn30 = pipe(x => x + 1, x => x * 2); diff --git a/tests/baselines/reference/genericFunctionInference1.symbols b/tests/baselines/reference/genericFunctionInference1.symbols index d49a20cec9c..9ee085feae8 100644 --- a/tests/baselines/reference/genericFunctionInference1.symbols +++ b/tests/baselines/reference/genericFunctionInference1.symbols @@ -65,222 +65,691 @@ declare function box(x: V): { value: V }; >value : Symbol(value, Decl(genericFunctionInference1.ts, 5, 32)) >V : Symbol(V, Decl(genericFunctionInference1.ts, 5, 21)) +declare function foo(x: T): T; +>foo : Symbol(foo, Decl(genericFunctionInference1.ts, 5, 44)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 6, 21)) +>value : Symbol(value, Decl(genericFunctionInference1.ts, 6, 32)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 6, 21)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 6, 45)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 6, 21)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 6, 21)) + const f00 = pipe(list); ->f00 : Symbol(f00, Decl(genericFunctionInference1.ts, 7, 5)) +>f00 : Symbol(f00, Decl(genericFunctionInference1.ts, 8, 5)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) >list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) const f01 = pipe(list, box); ->f01 : Symbol(f01, Decl(genericFunctionInference1.ts, 8, 5)) +>f01 : Symbol(f01, Decl(genericFunctionInference1.ts, 9, 5)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) >list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) >box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) -const f02 = pipe(x => list(x), box); ->f02 : Symbol(f02, Decl(genericFunctionInference1.ts, 9, 5)) +const f02 = pipe(box, list); +>f02 : Symbol(f02, Decl(genericFunctionInference1.ts, 10, 5)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 9, 17)) ->list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 9, 17)) >box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) - -const f03 = pipe(list, x => box(x)); ->f03 : Symbol(f03, Decl(genericFunctionInference1.ts, 10, 5)) ->pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) >list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 10, 22)) ->box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 10, 22)) -const f04 = pipe(x => list(x), x => box(x)) ->f04 : Symbol(f04, Decl(genericFunctionInference1.ts, 11, 5)) +const f03 = pipe(x => list(x), box); +>f03 : Symbol(f03, Decl(genericFunctionInference1.ts, 11, 5)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) >x : Symbol(x, Decl(genericFunctionInference1.ts, 11, 17)) >list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) >x : Symbol(x, Decl(genericFunctionInference1.ts, 11, 17)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 11, 30)) >box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 11, 30)) -const f05 = pipe(list, pipe(box)); ->f05 : Symbol(f05, Decl(genericFunctionInference1.ts, 12, 5)) +const f04 = pipe(list, x => box(x)); +>f04 : Symbol(f04, Decl(genericFunctionInference1.ts, 12, 5)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) >list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) ->pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 12, 22)) >box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 12, 22)) -const f06 = pipe(x => list(x), pipe(box)); ->f06 : Symbol(f06, Decl(genericFunctionInference1.ts, 13, 5)) +const f05 = pipe(x => list(x), x => box(x)) +>f05 : Symbol(f05, Decl(genericFunctionInference1.ts, 13, 5)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) >x : Symbol(x, Decl(genericFunctionInference1.ts, 13, 17)) >list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) >x : Symbol(x, Decl(genericFunctionInference1.ts, 13, 17)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 13, 30)) +>box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 13, 30)) + +const f06 = pipe(list, pipe(box)); +>f06 : Symbol(f06, Decl(genericFunctionInference1.ts, 14, 5)) +>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) >box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) -const f07 = pipe(x => list(x), pipe(x => box(x))); ->f07 : Symbol(f07, Decl(genericFunctionInference1.ts, 14, 5)) +const f07 = pipe(x => list(x), pipe(box)); +>f07 : Symbol(f07, Decl(genericFunctionInference1.ts, 15, 5)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 14, 17)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 15, 17)) >list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 14, 17)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 15, 17)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 14, 36)) ->box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 14, 36)) - -const f10: (x: T) => T[] = pipe(list); ->f10 : Symbol(f10, Decl(genericFunctionInference1.ts, 16, 5)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 16, 12)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 16, 15)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 16, 12)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 16, 12)) ->pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) ->list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) - -const f11: (x: T) => { value: T[] } = pipe(list, box); ->f11 : Symbol(f11, Decl(genericFunctionInference1.ts, 17, 5)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 17, 12)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 17, 15)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 17, 12)) ->value : Symbol(value, Decl(genericFunctionInference1.ts, 17, 25)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 17, 12)) ->pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) ->list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) >box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) -const f12: (x: T) => { value: T[] } = pipe(x => list(x), box); ->f12 : Symbol(f12, Decl(genericFunctionInference1.ts, 18, 5)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 18, 12)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 18, 15)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 18, 12)) ->value : Symbol(value, Decl(genericFunctionInference1.ts, 18, 25)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 18, 12)) +const f08 = pipe(x => list(x), pipe(x => box(x))); +>f08 : Symbol(f08, Decl(genericFunctionInference1.ts, 16, 5)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 18, 46)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 16, 17)) >list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 18, 46)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 16, 17)) +>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 16, 36)) >box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 16, 36)) -const f13: (x: T) => { value: T[] } = pipe(list, x => box(x)); ->f13 : Symbol(f13, Decl(genericFunctionInference1.ts, 19, 5)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 19, 12)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 19, 15)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 19, 12)) ->value : Symbol(value, Decl(genericFunctionInference1.ts, 19, 25)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 19, 12)) +const f09 = pipe(list, x => x.length); +>f09 : Symbol(f09, Decl(genericFunctionInference1.ts, 17, 5)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) >list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 19, 51)) ->box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 19, 51)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 17, 22)) +>x.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 17, 22)) +>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) -const f14: (x: T) => { value: T[] } = pipe(x => list(x), x => box(x)) ->f14 : Symbol(f14, Decl(genericFunctionInference1.ts, 20, 5)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 20, 12)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 20, 15)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 20, 12)) ->value : Symbol(value, Decl(genericFunctionInference1.ts, 20, 25)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 20, 12)) +const f10 = pipe(foo); +>f10 : Symbol(f10, Decl(genericFunctionInference1.ts, 18, 5)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 20, 46)) ->list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 20, 46)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 20, 59)) ->box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 20, 59)) +>foo : Symbol(foo, Decl(genericFunctionInference1.ts, 5, 44)) -const f15: (x: T) => { value: T[] } = pipe(list, pipe(box)); ->f15 : Symbol(f15, Decl(genericFunctionInference1.ts, 21, 5)) +const f11 = pipe(foo, foo); +>f11 : Symbol(f11, Decl(genericFunctionInference1.ts, 19, 5)) +>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) +>foo : Symbol(foo, Decl(genericFunctionInference1.ts, 5, 44)) +>foo : Symbol(foo, Decl(genericFunctionInference1.ts, 5, 44)) + +const g00: (x: T) => T[] = pipe(list); +>g00 : Symbol(g00, Decl(genericFunctionInference1.ts, 21, 5)) >T : Symbol(T, Decl(genericFunctionInference1.ts, 21, 12)) >x : Symbol(x, Decl(genericFunctionInference1.ts, 21, 15)) >T : Symbol(T, Decl(genericFunctionInference1.ts, 21, 12)) ->value : Symbol(value, Decl(genericFunctionInference1.ts, 21, 25)) >T : Symbol(T, Decl(genericFunctionInference1.ts, 21, 12)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) >list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) ->pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) ->box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) -const f16: (x: T) => { value: T[] } = pipe(x => list(x), pipe(box)); ->f16 : Symbol(f16, Decl(genericFunctionInference1.ts, 22, 5)) +const g01: (x: T) => { value: T[] } = pipe(list, box); +>g01 : Symbol(g01, Decl(genericFunctionInference1.ts, 22, 5)) >T : Symbol(T, Decl(genericFunctionInference1.ts, 22, 12)) >x : Symbol(x, Decl(genericFunctionInference1.ts, 22, 15)) >T : Symbol(T, Decl(genericFunctionInference1.ts, 22, 12)) >value : Symbol(value, Decl(genericFunctionInference1.ts, 22, 25)) >T : Symbol(T, Decl(genericFunctionInference1.ts, 22, 12)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 22, 46)) >list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 22, 46)) ->pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) >box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) -const f17: (x: T) => { value: T[] } = pipe(x => list(x), pipe(x => box(x))); ->f17 : Symbol(f17, Decl(genericFunctionInference1.ts, 23, 5)) +const g02: (x: T) => { value: T }[] = pipe(box, list); +>g02 : Symbol(g02, Decl(genericFunctionInference1.ts, 23, 5)) >T : Symbol(T, Decl(genericFunctionInference1.ts, 23, 12)) >x : Symbol(x, Decl(genericFunctionInference1.ts, 23, 15)) >T : Symbol(T, Decl(genericFunctionInference1.ts, 23, 12)) >value : Symbol(value, Decl(genericFunctionInference1.ts, 23, 25)) >T : Symbol(T, Decl(genericFunctionInference1.ts, 23, 12)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 23, 46)) ->list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 23, 46)) ->pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 23, 65)) >box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 23, 65)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) + +const g03: (x: T) => { value: T[] } = pipe(x => list(x), box); +>g03 : Symbol(g03, Decl(genericFunctionInference1.ts, 24, 5)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 24, 12)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 24, 15)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 24, 12)) +>value : Symbol(value, Decl(genericFunctionInference1.ts, 24, 25)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 24, 12)) +>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 24, 46)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 24, 46)) +>box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) + +const g04: (x: T) => { value: T[] } = pipe(list, x => box(x)); +>g04 : Symbol(g04, Decl(genericFunctionInference1.ts, 25, 5)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 25, 12)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 25, 15)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 25, 12)) +>value : Symbol(value, Decl(genericFunctionInference1.ts, 25, 25)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 25, 12)) +>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 25, 51)) +>box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 25, 51)) + +const g05: (x: T) => { value: T[] } = pipe(x => list(x), x => box(x)) +>g05 : Symbol(g05, Decl(genericFunctionInference1.ts, 26, 5)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 26, 12)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 26, 15)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 26, 12)) +>value : Symbol(value, Decl(genericFunctionInference1.ts, 26, 25)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 26, 12)) +>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 26, 46)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 26, 46)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 26, 59)) +>box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 26, 59)) + +const g06: (x: T) => { value: T[] } = pipe(list, pipe(box)); +>g06 : Symbol(g06, Decl(genericFunctionInference1.ts, 27, 5)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 27, 12)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 27, 15)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 27, 12)) +>value : Symbol(value, Decl(genericFunctionInference1.ts, 27, 25)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 27, 12)) +>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) +>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) +>box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) + +const g07: (x: T) => { value: T[] } = pipe(x => list(x), pipe(box)); +>g07 : Symbol(g07, Decl(genericFunctionInference1.ts, 28, 5)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 28, 12)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 28, 15)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 28, 12)) +>value : Symbol(value, Decl(genericFunctionInference1.ts, 28, 25)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 28, 12)) +>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 28, 46)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 28, 46)) +>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) +>box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) + +const g08: (x: T) => { value: T[] } = pipe(x => list(x), pipe(x => box(x))); +>g08 : Symbol(g08, Decl(genericFunctionInference1.ts, 29, 5)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 29, 12)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 29, 15)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 29, 12)) +>value : Symbol(value, Decl(genericFunctionInference1.ts, 29, 25)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 29, 12)) +>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 29, 46)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 29, 46)) +>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 29, 65)) +>box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 29, 65)) + +const g09: (x: T) => number = pipe(list, x => x.length); +>g09 : Symbol(g09, Decl(genericFunctionInference1.ts, 30, 5)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 30, 12)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 30, 15)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 30, 12)) +>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 30, 43)) +>x.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 30, 43)) +>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --)) + +const g10: (x: T) => T = pipe(foo); +>g10 : Symbol(g10, Decl(genericFunctionInference1.ts, 31, 5)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 31, 12)) +>value : Symbol(value, Decl(genericFunctionInference1.ts, 31, 23)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 31, 12)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 31, 36)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 31, 12)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 31, 12)) +>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) +>foo : Symbol(foo, Decl(genericFunctionInference1.ts, 5, 44)) + +const g12: (x: T) => T = pipe(foo, foo); +>g12 : Symbol(g12, Decl(genericFunctionInference1.ts, 32, 5)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 32, 12)) +>value : Symbol(value, Decl(genericFunctionInference1.ts, 32, 23)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 32, 12)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 32, 36)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 32, 12)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 32, 12)) +>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) +>foo : Symbol(foo, Decl(genericFunctionInference1.ts, 5, 44)) +>foo : Symbol(foo, Decl(genericFunctionInference1.ts, 5, 44)) + +declare function pipe2(ab: (a: A) => B, cd: (c: C) => D): (a: [A, C]) => [B, D]; +>pipe2 : Symbol(pipe2, Decl(genericFunctionInference1.ts, 32, 64)) +>A : Symbol(A, Decl(genericFunctionInference1.ts, 34, 23)) +>B : Symbol(B, Decl(genericFunctionInference1.ts, 34, 25)) +>C : Symbol(C, Decl(genericFunctionInference1.ts, 34, 28)) +>D : Symbol(D, Decl(genericFunctionInference1.ts, 34, 31)) +>ab : Symbol(ab, Decl(genericFunctionInference1.ts, 34, 35)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 34, 40)) +>A : Symbol(A, Decl(genericFunctionInference1.ts, 34, 23)) +>B : Symbol(B, Decl(genericFunctionInference1.ts, 34, 25)) +>cd : Symbol(cd, Decl(genericFunctionInference1.ts, 34, 51)) +>c : Symbol(c, Decl(genericFunctionInference1.ts, 34, 57)) +>C : Symbol(C, Decl(genericFunctionInference1.ts, 34, 28)) +>D : Symbol(D, Decl(genericFunctionInference1.ts, 34, 31)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 34, 71)) +>A : Symbol(A, Decl(genericFunctionInference1.ts, 34, 23)) +>C : Symbol(C, Decl(genericFunctionInference1.ts, 34, 28)) +>B : Symbol(B, Decl(genericFunctionInference1.ts, 34, 25)) +>D : Symbol(D, Decl(genericFunctionInference1.ts, 34, 31)) + +const f20 = pipe2(list, box); +>f20 : Symbol(f20, Decl(genericFunctionInference1.ts, 36, 5)) +>pipe2 : Symbol(pipe2, Decl(genericFunctionInference1.ts, 32, 64)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) +>box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) + +const f21 = pipe2(box, list); +>f21 : Symbol(f21, Decl(genericFunctionInference1.ts, 37, 5)) +>pipe2 : Symbol(pipe2, Decl(genericFunctionInference1.ts, 32, 64)) +>box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) + +const f22 = pipe2(list, list); +>f22 : Symbol(f22, Decl(genericFunctionInference1.ts, 38, 5)) +>pipe2 : Symbol(pipe2, Decl(genericFunctionInference1.ts, 32, 64)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) + +const f23 = pipe2(box, box); +>f23 : Symbol(f23, Decl(genericFunctionInference1.ts, 39, 5)) +>pipe2 : Symbol(pipe2, Decl(genericFunctionInference1.ts, 32, 64)) +>box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) +>box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) + +const f24 = pipe2(f20, f20); +>f24 : Symbol(f24, Decl(genericFunctionInference1.ts, 40, 5)) +>pipe2 : Symbol(pipe2, Decl(genericFunctionInference1.ts, 32, 64)) +>f20 : Symbol(f20, Decl(genericFunctionInference1.ts, 36, 5)) +>f20 : Symbol(f20, Decl(genericFunctionInference1.ts, 36, 5)) + +const f25 = pipe2(foo, foo); +>f25 : Symbol(f25, Decl(genericFunctionInference1.ts, 41, 5)) +>pipe2 : Symbol(pipe2, Decl(genericFunctionInference1.ts, 32, 64)) +>foo : Symbol(foo, Decl(genericFunctionInference1.ts, 5, 44)) +>foo : Symbol(foo, Decl(genericFunctionInference1.ts, 5, 44)) + +const f26 = pipe2(f25, f25); +>f26 : Symbol(f26, Decl(genericFunctionInference1.ts, 42, 5)) +>pipe2 : Symbol(pipe2, Decl(genericFunctionInference1.ts, 32, 64)) +>f25 : Symbol(f25, Decl(genericFunctionInference1.ts, 41, 5)) +>f25 : Symbol(f25, Decl(genericFunctionInference1.ts, 41, 5)) + +declare function pipe3(ab: (a: A) => B, ac: (a: A) => C): (a: A) => [B, C]; +>pipe3 : Symbol(pipe3, Decl(genericFunctionInference1.ts, 42, 28)) +>A : Symbol(A, Decl(genericFunctionInference1.ts, 44, 23)) +>B : Symbol(B, Decl(genericFunctionInference1.ts, 44, 25)) +>C : Symbol(C, Decl(genericFunctionInference1.ts, 44, 28)) +>ab : Symbol(ab, Decl(genericFunctionInference1.ts, 44, 32)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 44, 37)) +>A : Symbol(A, Decl(genericFunctionInference1.ts, 44, 23)) +>B : Symbol(B, Decl(genericFunctionInference1.ts, 44, 25)) +>ac : Symbol(ac, Decl(genericFunctionInference1.ts, 44, 48)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 44, 54)) +>A : Symbol(A, Decl(genericFunctionInference1.ts, 44, 23)) +>C : Symbol(C, Decl(genericFunctionInference1.ts, 44, 28)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 44, 68)) +>A : Symbol(A, Decl(genericFunctionInference1.ts, 44, 23)) +>B : Symbol(B, Decl(genericFunctionInference1.ts, 44, 25)) +>C : Symbol(C, Decl(genericFunctionInference1.ts, 44, 28)) + +const f30 = pipe3(list, box); +>f30 : Symbol(f30, Decl(genericFunctionInference1.ts, 46, 5)) +>pipe3 : Symbol(pipe3, Decl(genericFunctionInference1.ts, 42, 28)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) +>box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) + +const f31 = pipe3(box, list); +>f31 : Symbol(f31, Decl(genericFunctionInference1.ts, 47, 5)) +>pipe3 : Symbol(pipe3, Decl(genericFunctionInference1.ts, 42, 28)) +>box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) + +const f32 = pipe3(list, list); +>f32 : Symbol(f32, Decl(genericFunctionInference1.ts, 48, 5)) +>pipe3 : Symbol(pipe3, Decl(genericFunctionInference1.ts, 42, 28)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) + +declare function pipe4(funcs: [(a: A) => B, (b: B) => C]): (a: A) => C; +>pipe4 : Symbol(pipe4, Decl(genericFunctionInference1.ts, 48, 30)) +>A : Symbol(A, Decl(genericFunctionInference1.ts, 50, 23)) +>B : Symbol(B, Decl(genericFunctionInference1.ts, 50, 25)) +>C : Symbol(C, Decl(genericFunctionInference1.ts, 50, 28)) +>funcs : Symbol(funcs, Decl(genericFunctionInference1.ts, 50, 32)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 50, 41)) +>A : Symbol(A, Decl(genericFunctionInference1.ts, 50, 23)) +>B : Symbol(B, Decl(genericFunctionInference1.ts, 50, 25)) +>b : Symbol(b, Decl(genericFunctionInference1.ts, 50, 54)) +>B : Symbol(B, Decl(genericFunctionInference1.ts, 50, 25)) +>C : Symbol(C, Decl(genericFunctionInference1.ts, 50, 28)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 50, 69)) +>A : Symbol(A, Decl(genericFunctionInference1.ts, 50, 23)) +>C : Symbol(C, Decl(genericFunctionInference1.ts, 50, 28)) + +const f40 = pipe4([list, box]); +>f40 : Symbol(f40, Decl(genericFunctionInference1.ts, 52, 5)) +>pipe4 : Symbol(pipe4, Decl(genericFunctionInference1.ts, 48, 30)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) +>box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) + +const f41 = pipe4([box, list]); +>f41 : Symbol(f41, Decl(genericFunctionInference1.ts, 53, 5)) +>pipe4 : Symbol(pipe4, Decl(genericFunctionInference1.ts, 48, 30)) +>box : Symbol(box, Decl(genericFunctionInference1.ts, 4, 36)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) + +declare function pipe5(f: (a: A) => B): { f: (a: A) => B }; +>pipe5 : Symbol(pipe5, Decl(genericFunctionInference1.ts, 53, 31)) +>A : Symbol(A, Decl(genericFunctionInference1.ts, 55, 23)) +>B : Symbol(B, Decl(genericFunctionInference1.ts, 55, 25)) +>f : Symbol(f, Decl(genericFunctionInference1.ts, 55, 29)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 55, 33)) +>A : Symbol(A, Decl(genericFunctionInference1.ts, 55, 23)) +>B : Symbol(B, Decl(genericFunctionInference1.ts, 55, 25)) +>f : Symbol(f, Decl(genericFunctionInference1.ts, 55, 47)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 55, 52)) +>A : Symbol(A, Decl(genericFunctionInference1.ts, 55, 23)) +>B : Symbol(B, Decl(genericFunctionInference1.ts, 55, 25)) + +const f50 = pipe5(list); // No higher order inference +>f50 : Symbol(f50, Decl(genericFunctionInference1.ts, 57, 5)) +>pipe5 : Symbol(pipe5, Decl(genericFunctionInference1.ts, 53, 31)) +>list : Symbol(list, Decl(genericFunctionInference1.ts, 2, 124)) + +// #417 + +function mirror(f: (a: A) => B): (a: A) => B { return f; } +>mirror : Symbol(mirror, Decl(genericFunctionInference1.ts, 57, 24)) +>A : Symbol(A, Decl(genericFunctionInference1.ts, 61, 16)) +>B : Symbol(B, Decl(genericFunctionInference1.ts, 61, 18)) +>f : Symbol(f, Decl(genericFunctionInference1.ts, 61, 22)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 61, 26)) +>A : Symbol(A, Decl(genericFunctionInference1.ts, 61, 16)) +>B : Symbol(B, Decl(genericFunctionInference1.ts, 61, 18)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 61, 40)) +>A : Symbol(A, Decl(genericFunctionInference1.ts, 61, 16)) +>B : Symbol(B, Decl(genericFunctionInference1.ts, 61, 18)) +>f : Symbol(f, Decl(genericFunctionInference1.ts, 61, 22)) + +var identityM = mirror(identity); +>identityM : Symbol(identityM, Decl(genericFunctionInference1.ts, 62, 3)) +>mirror : Symbol(mirror, Decl(genericFunctionInference1.ts, 57, 24)) +>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 154, 13)) + +var x = 1; +>x : Symbol(x, Decl(genericFunctionInference1.ts, 64, 3)) + +var y = identity(x); +>y : Symbol(y, Decl(genericFunctionInference1.ts, 65, 3)) +>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 154, 13)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 64, 3)) + +var z = identityM(x); +>z : Symbol(z, Decl(genericFunctionInference1.ts, 66, 3)) +>identityM : Symbol(identityM, Decl(genericFunctionInference1.ts, 62, 3)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 64, 3)) + +// #3038 + +export function keyOf(value: { key: a; }): a { +>keyOf : Symbol(keyOf, Decl(genericFunctionInference1.ts, 66, 21)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 70, 22)) +>value : Symbol(value, Decl(genericFunctionInference1.ts, 70, 25)) +>key : Symbol(key, Decl(genericFunctionInference1.ts, 70, 33)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 70, 22)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 70, 22)) + + return value.key; +>value.key : Symbol(key, Decl(genericFunctionInference1.ts, 70, 33)) +>value : Symbol(value, Decl(genericFunctionInference1.ts, 70, 25)) +>key : Symbol(key, Decl(genericFunctionInference1.ts, 70, 33)) +} +export interface Data { +>Data : Symbol(Data, Decl(genericFunctionInference1.ts, 72, 1)) + + key: number; +>key : Symbol(Data.key, Decl(genericFunctionInference1.ts, 73, 23)) + + value: Date; +>value : Symbol(Data.value, Decl(genericFunctionInference1.ts, 74, 16)) +>Date : Symbol(Date, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.scripthost.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) +} + +var data: Data[] = []; +>data : Symbol(data, Decl(genericFunctionInference1.ts, 78, 3)) +>Data : Symbol(Data, Decl(genericFunctionInference1.ts, 72, 1)) + +declare function toKeys(values: a[], toKey: (value: a) => string): string[]; +>toKeys : Symbol(toKeys, Decl(genericFunctionInference1.ts, 78, 22)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 80, 24)) +>values : Symbol(values, Decl(genericFunctionInference1.ts, 80, 27)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 80, 24)) +>toKey : Symbol(toKey, Decl(genericFunctionInference1.ts, 80, 39)) +>value : Symbol(value, Decl(genericFunctionInference1.ts, 80, 48)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 80, 24)) + +toKeys(data, keyOf); // Error +>toKeys : Symbol(toKeys, Decl(genericFunctionInference1.ts, 78, 22)) +>data : Symbol(data, Decl(genericFunctionInference1.ts, 78, 3)) +>keyOf : Symbol(keyOf, Decl(genericFunctionInference1.ts, 66, 21)) + +// #9366 + +function flip(f: (a: a, b: b) => c): (b: b, a: a) => c { +>flip : Symbol(flip, Decl(genericFunctionInference1.ts, 82, 20)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 86, 14)) +>b : Symbol(b, Decl(genericFunctionInference1.ts, 86, 16)) +>c : Symbol(c, Decl(genericFunctionInference1.ts, 86, 19)) +>f : Symbol(f, Decl(genericFunctionInference1.ts, 86, 23)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 86, 27)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 86, 14)) +>b : Symbol(b, Decl(genericFunctionInference1.ts, 86, 32)) +>b : Symbol(b, Decl(genericFunctionInference1.ts, 86, 16)) +>c : Symbol(c, Decl(genericFunctionInference1.ts, 86, 19)) +>b : Symbol(b, Decl(genericFunctionInference1.ts, 86, 47)) +>b : Symbol(b, Decl(genericFunctionInference1.ts, 86, 16)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 86, 52)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 86, 14)) +>c : Symbol(c, Decl(genericFunctionInference1.ts, 86, 19)) + + return (b: b, a: a) => f(a, b); +>b : Symbol(b, Decl(genericFunctionInference1.ts, 87, 10)) +>b : Symbol(b, Decl(genericFunctionInference1.ts, 86, 16)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 87, 15)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 86, 14)) +>f : Symbol(f, Decl(genericFunctionInference1.ts, 86, 23)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 87, 15)) +>b : Symbol(b, Decl(genericFunctionInference1.ts, 87, 10)) +} +function zip(x: T, y: U): [T, U] { +>zip : Symbol(zip, Decl(genericFunctionInference1.ts, 88, 1)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 89, 13)) +>U : Symbol(U, Decl(genericFunctionInference1.ts, 89, 15)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 89, 19)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 89, 13)) +>y : Symbol(y, Decl(genericFunctionInference1.ts, 89, 24)) +>U : Symbol(U, Decl(genericFunctionInference1.ts, 89, 15)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 89, 13)) +>U : Symbol(U, Decl(genericFunctionInference1.ts, 89, 15)) + + return [x, y]; +>x : Symbol(x, Decl(genericFunctionInference1.ts, 89, 19)) +>y : Symbol(y, Decl(genericFunctionInference1.ts, 89, 24)) +} + +var expected: (y: U, x: T) => [T, U] = flip(zip); +>expected : Symbol(expected, Decl(genericFunctionInference1.ts, 93, 3)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 93, 15)) +>U : Symbol(U, Decl(genericFunctionInference1.ts, 93, 17)) +>y : Symbol(y, Decl(genericFunctionInference1.ts, 93, 21)) +>U : Symbol(U, Decl(genericFunctionInference1.ts, 93, 17)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 93, 26)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 93, 15)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 93, 15)) +>U : Symbol(U, Decl(genericFunctionInference1.ts, 93, 17)) +>flip : Symbol(flip, Decl(genericFunctionInference1.ts, 82, 20)) +>zip : Symbol(zip, Decl(genericFunctionInference1.ts, 88, 1)) + +var actual = flip(zip); +>actual : Symbol(actual, Decl(genericFunctionInference1.ts, 94, 3)) +>flip : Symbol(flip, Decl(genericFunctionInference1.ts, 82, 20)) +>zip : Symbol(zip, Decl(genericFunctionInference1.ts, 88, 1)) + +// #9366 + +const map = (transform: (t: T) => U) => +>map : Symbol(map, Decl(genericFunctionInference1.ts, 98, 5)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 98, 13)) +>U : Symbol(U, Decl(genericFunctionInference1.ts, 98, 15)) +>transform : Symbol(transform, Decl(genericFunctionInference1.ts, 98, 19)) +>t : Symbol(t, Decl(genericFunctionInference1.ts, 98, 31)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 98, 13)) +>U : Symbol(U, Decl(genericFunctionInference1.ts, 98, 15)) + + (arr: T[]) => arr.map(transform) +>arr : Symbol(arr, Decl(genericFunctionInference1.ts, 99, 5)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 98, 13)) +>arr.map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>arr : Symbol(arr, Decl(genericFunctionInference1.ts, 99, 5)) +>map : Symbol(Array.map, Decl(lib.es5.d.ts, --, --)) +>transform : Symbol(transform, Decl(genericFunctionInference1.ts, 98, 19)) + +const identityStr = (t: string) => t; +>identityStr : Symbol(identityStr, Decl(genericFunctionInference1.ts, 101, 5)) +>t : Symbol(t, Decl(genericFunctionInference1.ts, 101, 21)) +>t : Symbol(t, Decl(genericFunctionInference1.ts, 101, 21)) + +const arr: string[] = map(identityStr)(['a']); +>arr : Symbol(arr, Decl(genericFunctionInference1.ts, 103, 5)) +>map : Symbol(map, Decl(genericFunctionInference1.ts, 98, 5)) +>identityStr : Symbol(identityStr, Decl(genericFunctionInference1.ts, 101, 5)) + +const arr1: string[] = map(identity)(['a']); +>arr1 : Symbol(arr1, Decl(genericFunctionInference1.ts, 104, 5)) +>map : Symbol(map, Decl(genericFunctionInference1.ts, 98, 5)) +>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 154, 13)) + +// #9949 + +function of2(one: a, two: b): [a, b] { +>of2 : Symbol(of2, Decl(genericFunctionInference1.ts, 104, 44)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 108, 13)) +>b : Symbol(b, Decl(genericFunctionInference1.ts, 108, 15)) +>one : Symbol(one, Decl(genericFunctionInference1.ts, 108, 19)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 108, 13)) +>two : Symbol(two, Decl(genericFunctionInference1.ts, 108, 26)) +>b : Symbol(b, Decl(genericFunctionInference1.ts, 108, 15)) +>a : Symbol(a, Decl(genericFunctionInference1.ts, 108, 13)) +>b : Symbol(b, Decl(genericFunctionInference1.ts, 108, 15)) + + return [one, two]; +>one : Symbol(one, Decl(genericFunctionInference1.ts, 108, 19)) +>two : Symbol(two, Decl(genericFunctionInference1.ts, 108, 26)) +} + +const flipped = flip(of2); +>flipped : Symbol(flipped, Decl(genericFunctionInference1.ts, 112, 5)) +>flip : Symbol(flip, Decl(genericFunctionInference1.ts, 82, 20)) +>of2 : Symbol(of2, Decl(genericFunctionInference1.ts, 104, 44)) + +// #29904.1 + +type Component

= (props: P) => {}; +>Component : Symbol(Component, Decl(genericFunctionInference1.ts, 112, 26)) +>P : Symbol(P, Decl(genericFunctionInference1.ts, 116, 15)) +>props : Symbol(props, Decl(genericFunctionInference1.ts, 116, 21)) +>P : Symbol(P, Decl(genericFunctionInference1.ts, 116, 15)) + +declare const myHoc1:

(C: Component

) => Component

; +>myHoc1 : Symbol(myHoc1, Decl(genericFunctionInference1.ts, 118, 13)) +>P : Symbol(P, Decl(genericFunctionInference1.ts, 118, 23)) +>C : Symbol(C, Decl(genericFunctionInference1.ts, 118, 26)) +>Component : Symbol(Component, Decl(genericFunctionInference1.ts, 112, 26)) +>P : Symbol(P, Decl(genericFunctionInference1.ts, 118, 23)) +>Component : Symbol(Component, Decl(genericFunctionInference1.ts, 112, 26)) +>P : Symbol(P, Decl(genericFunctionInference1.ts, 118, 23)) + +declare const myHoc2:

(C: Component

) => Component

; +>myHoc2 : Symbol(myHoc2, Decl(genericFunctionInference1.ts, 119, 13)) +>P : Symbol(P, Decl(genericFunctionInference1.ts, 119, 23)) +>C : Symbol(C, Decl(genericFunctionInference1.ts, 119, 26)) +>Component : Symbol(Component, Decl(genericFunctionInference1.ts, 112, 26)) +>P : Symbol(P, Decl(genericFunctionInference1.ts, 119, 23)) +>Component : Symbol(Component, Decl(genericFunctionInference1.ts, 112, 26)) +>P : Symbol(P, Decl(genericFunctionInference1.ts, 119, 23)) + +declare const MyComponent1: Component<{ foo: 1 }>; +>MyComponent1 : Symbol(MyComponent1, Decl(genericFunctionInference1.ts, 121, 13)) +>Component : Symbol(Component, Decl(genericFunctionInference1.ts, 112, 26)) +>foo : Symbol(foo, Decl(genericFunctionInference1.ts, 121, 39)) + +const enhance = pipe( +>enhance : Symbol(enhance, Decl(genericFunctionInference1.ts, 123, 5)) +>pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) + + myHoc1, +>myHoc1 : Symbol(myHoc1, Decl(genericFunctionInference1.ts, 118, 13)) + + myHoc2, +>myHoc2 : Symbol(myHoc2, Decl(genericFunctionInference1.ts, 119, 13)) + +); + +const MyComponent2 = enhance(MyComponent1); +>MyComponent2 : Symbol(MyComponent2, Decl(genericFunctionInference1.ts, 128, 5)) +>enhance : Symbol(enhance, Decl(genericFunctionInference1.ts, 123, 5)) +>MyComponent1 : Symbol(MyComponent1, Decl(genericFunctionInference1.ts, 121, 13)) // #29904.2 const fn20 = pipe((_a?: {}) => 1); ->fn20 : Symbol(fn20, Decl(genericFunctionInference1.ts, 27, 5)) +>fn20 : Symbol(fn20, Decl(genericFunctionInference1.ts, 132, 5)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) ->_a : Symbol(_a, Decl(genericFunctionInference1.ts, 27, 19)) +>_a : Symbol(_a, Decl(genericFunctionInference1.ts, 132, 19)) // #29904.3 type Fn = (n: number) => number; ->Fn : Symbol(Fn, Decl(genericFunctionInference1.ts, 27, 34)) ->n : Symbol(n, Decl(genericFunctionInference1.ts, 31, 11)) +>Fn : Symbol(Fn, Decl(genericFunctionInference1.ts, 132, 34)) +>n : Symbol(n, Decl(genericFunctionInference1.ts, 136, 11)) const fn30: Fn = pipe( ->fn30 : Symbol(fn30, Decl(genericFunctionInference1.ts, 32, 5)) ->Fn : Symbol(Fn, Decl(genericFunctionInference1.ts, 27, 34)) +>fn30 : Symbol(fn30, Decl(genericFunctionInference1.ts, 137, 5)) +>Fn : Symbol(Fn, Decl(genericFunctionInference1.ts, 132, 34)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) x => x + 1, ->x : Symbol(x, Decl(genericFunctionInference1.ts, 32, 22)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 32, 22)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 137, 22)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 137, 22)) x => x * 2, ->x : Symbol(x, Decl(genericFunctionInference1.ts, 33, 15)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 33, 15)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 138, 15)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 138, 15)) ); const promise = Promise.resolve(1); ->promise : Symbol(promise, Decl(genericFunctionInference1.ts, 37, 5)) +>promise : Symbol(promise, Decl(genericFunctionInference1.ts, 142, 5)) >Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) >Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) >resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --)) promise.then( >promise.then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) ->promise : Symbol(promise, Decl(genericFunctionInference1.ts, 37, 5)) +>promise : Symbol(promise, Decl(genericFunctionInference1.ts, 142, 5)) >then : Symbol(Promise.then, Decl(lib.es5.d.ts, --, --)) pipe( >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) x => x + 1, ->x : Symbol(x, Decl(genericFunctionInference1.ts, 39, 9)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 39, 9)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 144, 9)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 144, 9)) x => x * 2, ->x : Symbol(x, Decl(genericFunctionInference1.ts, 40, 19)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 40, 19)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 145, 19)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 145, 19)) ), ); @@ -288,94 +757,94 @@ promise.then( // #29904.4 declare const getString: () => string; ->getString : Symbol(getString, Decl(genericFunctionInference1.ts, 47, 13)) +>getString : Symbol(getString, Decl(genericFunctionInference1.ts, 152, 13)) declare const orUndefined: (name: string) => string | undefined; ->orUndefined : Symbol(orUndefined, Decl(genericFunctionInference1.ts, 48, 13)) ->name : Symbol(name, Decl(genericFunctionInference1.ts, 48, 28)) +>orUndefined : Symbol(orUndefined, Decl(genericFunctionInference1.ts, 153, 13)) +>name : Symbol(name, Decl(genericFunctionInference1.ts, 153, 28)) declare const identity: (value: T) => T; ->identity : Symbol(identity, Decl(genericFunctionInference1.ts, 49, 13)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 49, 25)) ->value : Symbol(value, Decl(genericFunctionInference1.ts, 49, 28)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 49, 25)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 49, 25)) +>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 154, 13)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 154, 25)) +>value : Symbol(value, Decl(genericFunctionInference1.ts, 154, 28)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 154, 25)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 154, 25)) const fn40 = pipe( ->fn40 : Symbol(fn40, Decl(genericFunctionInference1.ts, 51, 5)) +>fn40 : Symbol(fn40, Decl(genericFunctionInference1.ts, 156, 5)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) getString, ->getString : Symbol(getString, Decl(genericFunctionInference1.ts, 47, 13)) +>getString : Symbol(getString, Decl(genericFunctionInference1.ts, 152, 13)) string => orUndefined(string), ->string : Symbol(string, Decl(genericFunctionInference1.ts, 52, 14)) ->orUndefined : Symbol(orUndefined, Decl(genericFunctionInference1.ts, 48, 13)) ->string : Symbol(string, Decl(genericFunctionInference1.ts, 52, 14)) +>string : Symbol(string, Decl(genericFunctionInference1.ts, 157, 14)) +>orUndefined : Symbol(orUndefined, Decl(genericFunctionInference1.ts, 153, 13)) +>string : Symbol(string, Decl(genericFunctionInference1.ts, 157, 14)) identity, ->identity : Symbol(identity, Decl(genericFunctionInference1.ts, 49, 13)) +>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 154, 13)) ); // #29904.6 declare const getArray: () => string[]; ->getArray : Symbol(getArray, Decl(genericFunctionInference1.ts, 59, 13)) +>getArray : Symbol(getArray, Decl(genericFunctionInference1.ts, 164, 13)) declare const first: (ts: T[]) => T; ->first : Symbol(first, Decl(genericFunctionInference1.ts, 60, 13)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 60, 22)) ->ts : Symbol(ts, Decl(genericFunctionInference1.ts, 60, 25)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 60, 22)) ->T : Symbol(T, Decl(genericFunctionInference1.ts, 60, 22)) +>first : Symbol(first, Decl(genericFunctionInference1.ts, 165, 13)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 165, 22)) +>ts : Symbol(ts, Decl(genericFunctionInference1.ts, 165, 25)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 165, 22)) +>T : Symbol(T, Decl(genericFunctionInference1.ts, 165, 22)) const fn60 = pipe( ->fn60 : Symbol(fn60, Decl(genericFunctionInference1.ts, 62, 5)) +>fn60 : Symbol(fn60, Decl(genericFunctionInference1.ts, 167, 5)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) getArray, ->getArray : Symbol(getArray, Decl(genericFunctionInference1.ts, 59, 13)) +>getArray : Symbol(getArray, Decl(genericFunctionInference1.ts, 164, 13)) x => x, ->x : Symbol(x, Decl(genericFunctionInference1.ts, 63, 13)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 63, 13)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 168, 13)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 168, 13)) first, ->first : Symbol(first, Decl(genericFunctionInference1.ts, 60, 13)) +>first : Symbol(first, Decl(genericFunctionInference1.ts, 165, 13)) ); const fn61 = pipe( ->fn61 : Symbol(fn61, Decl(genericFunctionInference1.ts, 68, 5)) +>fn61 : Symbol(fn61, Decl(genericFunctionInference1.ts, 173, 5)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) getArray, ->getArray : Symbol(getArray, Decl(genericFunctionInference1.ts, 59, 13)) +>getArray : Symbol(getArray, Decl(genericFunctionInference1.ts, 164, 13)) identity, ->identity : Symbol(identity, Decl(genericFunctionInference1.ts, 49, 13)) +>identity : Symbol(identity, Decl(genericFunctionInference1.ts, 154, 13)) first, ->first : Symbol(first, Decl(genericFunctionInference1.ts, 60, 13)) +>first : Symbol(first, Decl(genericFunctionInference1.ts, 165, 13)) ); const fn62 = pipe( ->fn62 : Symbol(fn62, Decl(genericFunctionInference1.ts, 74, 5)) +>fn62 : Symbol(fn62, Decl(genericFunctionInference1.ts, 179, 5)) >pipe : Symbol(pipe, Decl(genericFunctionInference1.ts, 0, 0), Decl(genericFunctionInference1.ts, 0, 84), Decl(genericFunctionInference1.ts, 1, 104)) getArray, ->getArray : Symbol(getArray, Decl(genericFunctionInference1.ts, 59, 13)) +>getArray : Symbol(getArray, Decl(genericFunctionInference1.ts, 164, 13)) x => x, ->x : Symbol(x, Decl(genericFunctionInference1.ts, 75, 13)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 75, 13)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 180, 13)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 180, 13)) x => first(x), ->x : Symbol(x, Decl(genericFunctionInference1.ts, 76, 11)) ->first : Symbol(first, Decl(genericFunctionInference1.ts, 60, 13)) ->x : Symbol(x, Decl(genericFunctionInference1.ts, 76, 11)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 181, 11)) +>first : Symbol(first, Decl(genericFunctionInference1.ts, 165, 13)) +>x : Symbol(x, Decl(genericFunctionInference1.ts, 181, 11)) ); diff --git a/tests/baselines/reference/genericFunctionInference1.types b/tests/baselines/reference/genericFunctionInference1.types index cf85c1b5afb..e68b0ed6da0 100644 --- a/tests/baselines/reference/genericFunctionInference1.types +++ b/tests/baselines/reference/genericFunctionInference1.types @@ -32,6 +32,11 @@ declare function box(x: V): { value: V }; >x : V >value : V +declare function foo(x: T): T; +>foo : (x: T) => T +>value : T +>x : T + const f00 = pipe(list); >f00 : (a: T) => T[] >pipe(list) : (a: T) => T[] @@ -45,8 +50,15 @@ const f01 = pipe(list, box); >list : (a: T) => T[] >box : (x: V) => { value: V; } -const f02 = pipe(x => list(x), box); ->f02 : (x: any) => { value: any[]; } +const f02 = pipe(box, list); +>f02 : (x: V) => { value: V; }[] +>pipe(box, list) : (x: V) => { value: V; }[] +>pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } +>box : (x: V) => { value: V; } +>list : (a: T) => T[] + +const f03 = pipe(x => list(x), box); +>f03 : (x: any) => { value: any[]; } >pipe(x => list(x), box) : (x: any) => { value: any[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >x => list(x) : (x: any) => any[] @@ -56,8 +68,8 @@ const f02 = pipe(x => list(x), box); >x : any >box : (x: V) => { value: V; } -const f03 = pipe(list, x => box(x)); ->f03 : (a: T) => { value: T[]; } +const f04 = pipe(list, x => box(x)); +>f04 : (a: T) => { value: T[]; } >pipe(list, x => box(x)) : (a: T) => { value: T[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >list : (a: T) => T[] @@ -67,8 +79,8 @@ const f03 = pipe(list, x => box(x)); >box : (x: V) => { value: V; } >x : T[] -const f04 = pipe(x => list(x), x => box(x)) ->f04 : (x: any) => { value: any[]; } +const f05 = pipe(x => list(x), x => box(x)) +>f05 : (x: any) => { value: any[]; } >pipe(x => list(x), x => box(x)) : (x: any) => { value: any[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >x => list(x) : (x: any) => any[] @@ -82,8 +94,8 @@ const f04 = pipe(x => list(x), x => box(x)) >box : (x: V) => { value: V; } >x : any[] -const f05 = pipe(list, pipe(box)); ->f05 : (a: T) => { value: T[]; } +const f06 = pipe(list, pipe(box)); +>f06 : (a: T) => { value: T[]; } >pipe(list, pipe(box)) : (a: T) => { value: T[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >list : (a: T) => T[] @@ -91,8 +103,8 @@ const f05 = pipe(list, pipe(box)); >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >box : (x: V) => { value: V; } -const f06 = pipe(x => list(x), pipe(box)); ->f06 : (x: any) => { value: any[]; } +const f07 = pipe(x => list(x), pipe(box)); +>f07 : (x: any) => { value: any[]; } >pipe(x => list(x), pipe(box)) : (x: any) => { value: any[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >x => list(x) : (x: any) => any[] @@ -104,8 +116,8 @@ const f06 = pipe(x => list(x), pipe(box)); >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >box : (x: V) => { value: V; } -const f07 = pipe(x => list(x), pipe(x => box(x))); ->f07 : (x: any) => { value: any[]; } +const f08 = pipe(x => list(x), pipe(x => box(x))); +>f08 : (x: any) => { value: any[]; } >pipe(x => list(x), pipe(x => box(x))) : (x: any) => { value: any[]; } >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >x => list(x) : (x: any) => any[] @@ -121,15 +133,39 @@ const f07 = pipe(x => list(x), pipe(x => box(x))); >box : (x: V) => { value: V; } >x : any[] -const f10: (x: T) => T[] = pipe(list); ->f10 : (x: T) => T[] +const f09 = pipe(list, x => x.length); +>f09 : (a: T) => number +>pipe(list, x => x.length) : (a: T) => number +>pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } +>list : (a: T) => T[] +>x => x.length : (x: T[]) => number +>x : T[] +>x.length : number +>x : T[] +>length : number + +const f10 = pipe(foo); +>f10 : (x: T) => T +>pipe(foo) : (x: T) => T +>pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } +>foo : (x: T) => T + +const f11 = pipe(foo, foo); +>f11 : (x: T) => T +>pipe(foo, foo) : (x: T) => T +>pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } +>foo : (x: T) => T +>foo : (x: T) => T + +const g00: (x: T) => T[] = pipe(list); +>g00 : (x: T) => T[] >x : T >pipe(list) : (a: T) => T[] >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >list : (a: T) => T[] -const f11: (x: T) => { value: T[] } = pipe(list, box); ->f11 : (x: T) => { value: T[]; } +const g01: (x: T) => { value: T[] } = pipe(list, box); +>g01 : (x: T) => { value: T[]; } >x : T >value : T[] >pipe(list, box) : (a: T) => { value: T[]; } @@ -137,8 +173,17 @@ const f11: (x: T) => { value: T[] } = pipe(list, box); >list : (a: T) => T[] >box : (x: V) => { value: V; } -const f12: (x: T) => { value: T[] } = pipe(x => list(x), box); ->f12 : (x: T) => { value: T[]; } +const g02: (x: T) => { value: T }[] = pipe(box, list); +>g02 : (x: T) => { value: T; }[] +>x : T +>value : T +>pipe(box, list) : (x: T) => { value: T; }[] +>pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } +>box : (x: V) => { value: V; } +>list : (a: T) => T[] + +const g03: (x: T) => { value: T[] } = pipe(x => list(x), box); +>g03 : (x: T) => { value: T[]; } >x : T >value : T[] >pipe(x => list(x), box) : (x: T) => { value: T[]; } @@ -150,8 +195,8 @@ const f12: (x: T) => { value: T[] } = pipe(x => list(x), box); >x : T >box : (x: V) => { value: V; } -const f13: (x: T) => { value: T[] } = pipe(list, x => box(x)); ->f13 : (x: T) => { value: T[]; } +const g04: (x: T) => { value: T[] } = pipe(list, x => box(x)); +>g04 : (x: T) => { value: T[]; } >x : T >value : T[] >pipe(list, x => box(x)) : (a: T) => { value: T[]; } @@ -163,8 +208,8 @@ const f13: (x: T) => { value: T[] } = pipe(list, x => box(x)); >box : (x: V) => { value: V; } >x : T[] -const f14: (x: T) => { value: T[] } = pipe(x => list(x), x => box(x)) ->f14 : (x: T) => { value: T[]; } +const g05: (x: T) => { value: T[] } = pipe(x => list(x), x => box(x)) +>g05 : (x: T) => { value: T[]; } >x : T >value : T[] >pipe(x => list(x), x => box(x)) : (x: T) => { value: T[]; } @@ -180,8 +225,8 @@ const f14: (x: T) => { value: T[] } = pipe(x => list(x), x => box(x)) >box : (x: V) => { value: V; } >x : T[] -const f15: (x: T) => { value: T[] } = pipe(list, pipe(box)); ->f15 : (x: T) => { value: T[]; } +const g06: (x: T) => { value: T[] } = pipe(list, pipe(box)); +>g06 : (x: T) => { value: T[]; } >x : T >value : T[] >pipe(list, pipe(box)) : (a: T) => { value: T[]; } @@ -191,8 +236,8 @@ const f15: (x: T) => { value: T[] } = pipe(list, pipe(box)); >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >box : (x: V) => { value: V; } -const f16: (x: T) => { value: T[] } = pipe(x => list(x), pipe(box)); ->f16 : (x: T) => { value: T[]; } +const g07: (x: T) => { value: T[] } = pipe(x => list(x), pipe(box)); +>g07 : (x: T) => { value: T[]; } >x : T >value : T[] >pipe(x => list(x), pipe(box)) : (x: T) => { value: T[]; } @@ -206,8 +251,8 @@ const f16: (x: T) => { value: T[] } = pipe(x => list(x), pipe(box)); >pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } >box : (x: V) => { value: V; } -const f17: (x: T) => { value: T[] } = pipe(x => list(x), pipe(x => box(x))); ->f17 : (x: T) => { value: T[]; } +const g08: (x: T) => { value: T[] } = pipe(x => list(x), pipe(x => box(x))); +>g08 : (x: T) => { value: T[]; } >x : T >value : T[] >pipe(x => list(x), pipe(x => box(x))) : (x: T) => { value: T[]; } @@ -225,6 +270,365 @@ const f17: (x: T) => { value: T[] } = pipe(x => list(x), pipe(x => box(x))); >box : (x: V) => { value: V; } >x : T[] +const g09: (x: T) => number = pipe(list, x => x.length); +>g09 : (x: T) => number +>x : T +>pipe(list, x => x.length) : (a: T) => number +>pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } +>list : (a: T) => T[] +>x => x.length : (x: T[]) => number +>x : T[] +>x.length : number +>x : T[] +>length : number + +const g10: (x: T) => T = pipe(foo); +>g10 : (x: T) => T +>value : T +>x : T +>pipe(foo) : (x: T) => T +>pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } +>foo : (x: T) => T + +const g12: (x: T) => T = pipe(foo, foo); +>g12 : (x: T) => T +>value : T +>x : T +>pipe(foo, foo) : (x: T) => T +>pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } +>foo : (x: T) => T +>foo : (x: T) => T + +declare function pipe2(ab: (a: A) => B, cd: (c: C) => D): (a: [A, C]) => [B, D]; +>pipe2 : (ab: (a: A) => B, cd: (c: C) => D) => (a: [A, C]) => [B, D] +>ab : (a: A) => B +>a : A +>cd : (c: C) => D +>c : C +>a : [A, C] + +const f20 = pipe2(list, box); +>f20 : (a: [T, V]) => [T[], { value: V; }] +>pipe2(list, box) : (a: [T, V]) => [T[], { value: V; }] +>pipe2 : (ab: (a: A) => B, cd: (c: C) => D) => (a: [A, C]) => [B, D] +>list : (a: T) => T[] +>box : (x: V) => { value: V; } + +const f21 = pipe2(box, list); +>f21 : (a: [V, T]) => [{ value: V; }, T[]] +>pipe2(box, list) : (a: [V, T]) => [{ value: V; }, T[]] +>pipe2 : (ab: (a: A) => B, cd: (c: C) => D) => (a: [A, C]) => [B, D] +>box : (x: V) => { value: V; } +>list : (a: T) => T[] + +const f22 = pipe2(list, list); +>f22 : (a: [T, T1]) => [T[], T1[]] +>pipe2(list, list) : (a: [T, T1]) => [T[], T1[]] +>pipe2 : (ab: (a: A) => B, cd: (c: C) => D) => (a: [A, C]) => [B, D] +>list : (a: T) => T[] +>list : (a: T) => T[] + +const f23 = pipe2(box, box); +>f23 : (a: [V, V1]) => [{ value: V; }, { value: V1; }] +>pipe2(box, box) : (a: [V, V1]) => [{ value: V; }, { value: V1; }] +>pipe2 : (ab: (a: A) => B, cd: (c: C) => D) => (a: [A, C]) => [B, D] +>box : (x: V) => { value: V; } +>box : (x: V) => { value: V; } + +const f24 = pipe2(f20, f20); +>f24 : (a: [[T, V], [T1, V1]]) => [[T[], { value: V; }], [T1[], { value: V1; }]] +>pipe2(f20, f20) : (a: [[T, V], [T1, V1]]) => [[T[], { value: V; }], [T1[], { value: V1; }]] +>pipe2 : (ab: (a: A) => B, cd: (c: C) => D) => (a: [A, C]) => [B, D] +>f20 : (a: [T, V]) => [T[], { value: V; }] +>f20 : (a: [T, V]) => [T[], { value: V; }] + +const f25 = pipe2(foo, foo); +>f25 : (a: [T, T1]) => [T, T1] +>pipe2(foo, foo) : (a: [T, T1]) => [T, T1] +>pipe2 : (ab: (a: A) => B, cd: (c: C) => D) => (a: [A, C]) => [B, D] +>foo : (x: T) => T +>foo : (x: T) => T + +const f26 = pipe2(f25, f25); +>f26 : (a: [[T, T1], [T2, T3]]) => [[T, T1], [T2, T3]] +>pipe2(f25, f25) : (a: [[T, T1], [T2, T3]]) => [[T, T1], [T2, T3]] +>pipe2 : (ab: (a: A) => B, cd: (c: C) => D) => (a: [A, C]) => [B, D] +>f25 : (a: [T, T1]) => [T, T1] +>f25 : (a: [T, T1]) => [T, T1] + +declare function pipe3(ab: (a: A) => B, ac: (a: A) => C): (a: A) => [B, C]; +>pipe3 : (ab: (a: A) => B, ac: (a: A) => C) => (a: A) => [B, C] +>ab : (a: A) => B +>a : A +>ac : (a: A) => C +>a : A +>a : A + +const f30 = pipe3(list, box); +>f30 : (a: T) => [T[], { value: T; }] +>pipe3(list, box) : (a: T) => [T[], { value: T; }] +>pipe3 : (ab: (a: A) => B, ac: (a: A) => C) => (a: A) => [B, C] +>list : (a: T) => T[] +>box : (x: V) => { value: V; } + +const f31 = pipe3(box, list); +>f31 : (a: V) => [{ value: V; }, V[]] +>pipe3(box, list) : (a: V) => [{ value: V; }, V[]] +>pipe3 : (ab: (a: A) => B, ac: (a: A) => C) => (a: A) => [B, C] +>box : (x: V) => { value: V; } +>list : (a: T) => T[] + +const f32 = pipe3(list, list); +>f32 : (a: T) => [T[], T[]] +>pipe3(list, list) : (a: T) => [T[], T[]] +>pipe3 : (ab: (a: A) => B, ac: (a: A) => C) => (a: A) => [B, C] +>list : (a: T) => T[] +>list : (a: T) => T[] + +declare function pipe4(funcs: [(a: A) => B, (b: B) => C]): (a: A) => C; +>pipe4 : (funcs: [(a: A) => B, (b: B) => C]) => (a: A) => C +>funcs : [(a: A) => B, (b: B) => C] +>a : A +>b : B +>a : A + +const f40 = pipe4([list, box]); +>f40 : (a: T) => { value: T[]; } +>pipe4([list, box]) : (a: T) => { value: T[]; } +>pipe4 : (funcs: [(a: A) => B, (b: B) => C]) => (a: A) => C +>[list, box] : [(a: T) => T[], (x: V) => { value: V; }] +>list : (a: T) => T[] +>box : (x: V) => { value: V; } + +const f41 = pipe4([box, list]); +>f41 : (a: V) => { value: V; }[] +>pipe4([box, list]) : (a: V) => { value: V; }[] +>pipe4 : (funcs: [(a: A) => B, (b: B) => C]) => (a: A) => C +>[box, list] : [(x: V) => { value: V; }, (a: T) => T[]] +>box : (x: V) => { value: V; } +>list : (a: T) => T[] + +declare function pipe5(f: (a: A) => B): { f: (a: A) => B }; +>pipe5 : (f: (a: A) => B) => { f: (a: A) => B; } +>f : (a: A) => B +>a : A +>f : (a: A) => B +>a : A + +const f50 = pipe5(list); // No higher order inference +>f50 : { f: (a: {}) => {}[]; } +>pipe5(list) : { f: (a: {}) => {}[]; } +>pipe5 : (f: (a: A) => B) => { f: (a: A) => B; } +>list : (a: T) => T[] + +// #417 + +function mirror(f: (a: A) => B): (a: A) => B { return f; } +>mirror : (f: (a: A) => B) => (a: A) => B +>f : (a: A) => B +>a : A +>a : A +>f : (a: A) => B + +var identityM = mirror(identity); +>identityM : (a: T) => T +>mirror(identity) : (a: T) => T +>mirror : (f: (a: A) => B) => (a: A) => B +>identity : (value: T) => T + +var x = 1; +>x : number +>1 : 1 + +var y = identity(x); +>y : number +>identity(x) : number +>identity : (value: T) => T +>x : number + +var z = identityM(x); +>z : number +>identityM(x) : number +>identityM : (a: T) => T +>x : number + +// #3038 + +export function keyOf(value: { key: a; }): a { +>keyOf : (value: { key: a; }) => a +>value : { key: a; } +>key : a + + return value.key; +>value.key : a +>value : { key: a; } +>key : a +} +export interface Data { + key: number; +>key : number + + value: Date; +>value : Date +} + +var data: Data[] = []; +>data : Data[] +>[] : never[] + +declare function toKeys(values: a[], toKey: (value: a) => string): string[]; +>toKeys : (values: a[], toKey: (value: a) => string) => string[] +>values : a[] +>toKey : (value: a) => string +>value : a + +toKeys(data, keyOf); // Error +>toKeys(data, keyOf) : any +>toKeys : (values: a[], toKey: (value: a) => string) => string[] +>data : Data[] +>keyOf : (value: { key: a; }) => a + +// #9366 + +function flip(f: (a: a, b: b) => c): (b: b, a: a) => c { +>flip : (f: (a: a, b: b) => c) => (b: b, a: a) => c +>f : (a: a, b: b) => c +>a : a +>b : b +>b : b +>a : a + + return (b: b, a: a) => f(a, b); +>(b: b, a: a) => f(a, b) : (b: b, a: a) => c +>b : b +>a : a +>f(a, b) : c +>f : (a: a, b: b) => c +>a : a +>b : b +} +function zip(x: T, y: U): [T, U] { +>zip : (x: T, y: U) => [T, U] +>x : T +>y : U + + return [x, y]; +>[x, y] : [T, U] +>x : T +>y : U +} + +var expected: (y: U, x: T) => [T, U] = flip(zip); +>expected : (y: U, x: T) => [T, U] +>y : U +>x : T +>flip(zip) : (b: U, a: T) => [T, U] +>flip : (f: (a: a, b: b) => c) => (b: b, a: a) => c +>zip : (x: T, y: U) => [T, U] + +var actual = flip(zip); +>actual : (b: U, a: T) => [T, U] +>flip(zip) : (b: U, a: T) => [T, U] +>flip : (f: (a: a, b: b) => c) => (b: b, a: a) => c +>zip : (x: T, y: U) => [T, U] + +// #9366 + +const map = (transform: (t: T) => U) => +>map : (transform: (t: T) => U) => (arr: T[]) => U[] +>(transform: (t: T) => U) => (arr: T[]) => arr.map(transform) : (transform: (t: T) => U) => (arr: T[]) => U[] +>transform : (t: T) => U +>t : T + + (arr: T[]) => arr.map(transform) +>(arr: T[]) => arr.map(transform) : (arr: T[]) => U[] +>arr : T[] +>arr.map(transform) : U[] +>arr.map : (callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any) => U[] +>arr : T[] +>map : (callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any) => U[] +>transform : (t: T) => U + +const identityStr = (t: string) => t; +>identityStr : (t: string) => string +>(t: string) => t : (t: string) => string +>t : string +>t : string + +const arr: string[] = map(identityStr)(['a']); +>arr : string[] +>map(identityStr)(['a']) : string[] +>map(identityStr) : (arr: string[]) => string[] +>map : (transform: (t: T) => U) => (arr: T[]) => U[] +>identityStr : (t: string) => string +>['a'] : string[] +>'a' : "a" + +const arr1: string[] = map(identity)(['a']); +>arr1 : string[] +>map(identity)(['a']) : string[] +>map(identity) : (arr: T[]) => T[] +>map : (transform: (t: T) => U) => (arr: T[]) => U[] +>identity : (value: T) => T +>['a'] : string[] +>'a' : "a" + +// #9949 + +function of2(one: a, two: b): [a, b] { +>of2 : (one: a, two: b) => [a, b] +>one : a +>two : b + + return [one, two]; +>[one, two] : [a, b] +>one : a +>two : b +} + +const flipped = flip(of2); +>flipped : (b: b, a: a) => [a, b] +>flip(of2) : (b: b, a: a) => [a, b] +>flip : (f: (a: a, b: b) => c) => (b: b, a: a) => c +>of2 : (one: a, two: b) => [a, b] + +// #29904.1 + +type Component

= (props: P) => {}; +>Component : Component

+>props : P + +declare const myHoc1:

(C: Component

) => Component

; +>myHoc1 :

(C: Component

) => Component

+>C : Component

+ +declare const myHoc2:

(C: Component

) => Component

; +>myHoc2 :

(C: Component

) => Component

+>C : Component

+ +declare const MyComponent1: Component<{ foo: 1 }>; +>MyComponent1 : Component<{ foo: 1; }> +>foo : 1 + +const enhance = pipe( +>enhance :

(C: Component

) => Component

+>pipe( myHoc1, myHoc2,) :

(C: Component

) => Component

+>pipe : { (ab: (...args: A) => B): (...args: A) => B; (ab: (...args: A) => B, bc: (b: B) => C): (...args: A) => C; (ab: (...args: A) => B, bc: (b: B) => C, cd: (c: C) => D): (...args: A) => D; } + + myHoc1, +>myHoc1 :

(C: Component

) => Component

+ + myHoc2, +>myHoc2 :

(C: Component

) => Component

+ +); + +const MyComponent2 = enhance(MyComponent1); +>MyComponent2 : Component<{ foo: 1; }> +>enhance(MyComponent1) : Component<{ foo: 1; }> +>enhance :

(C: Component

) => Component

+>MyComponent1 : Component<{ foo: 1; }> + // #29904.2 const fn20 = pipe((_a?: {}) => 1);