forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose-function.d.ts
More file actions
31 lines (28 loc) · 765 Bytes
/
compose-function.d.ts
File metadata and controls
31 lines (28 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Type definitions for compose-function
// Project: https://github.com/stoeffel/compose-function
// Definitions by: Denis Sokolov <https://github.com/denis-sokolov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "compose-function" {
// Hardcoded signatures for 2-4 parameters
function f<A, B, C>(
f1: (b: B) => C,
f2: (a: A) => B
): (a: A) => C
function f<A, B, C, D>(
f1: (b: C) => D,
f2: (a: B) => C,
f3: (a: A) => B
): (a: A) => D
function f<A, B, C, D, E>(
f1: (b: D) => E,
f2: (a: C) => D,
f3: (a: B) => C,
f4: (a: A) => B
): (a: A) => E
// Minimal typing for more than 4 parameters
function f<Result>(
f1: (a: any) => Result,
...functions: Function[]
): (a: any) => Result
export = f;
}