UNPKG

2.46 kBTypeScriptView Raw
1import * as Koa from "koa";
2
3declare function compose<T1, U1, T2, U2>(
4 middleware: [Koa.Middleware<T1, U1>, Koa.Middleware<T2, U2>],
5): Koa.Middleware<T1 & T2, U1 & U2>;
6
7declare function compose<T1, U1, T2, U2, T3, U3>(
8 middleware: [Koa.Middleware<T1, U1>, Koa.Middleware<T2, U2>, Koa.Middleware<T3, U3>],
9): Koa.Middleware<T1 & T2 & T3, U1 & U2 & U3>;
10
11declare function compose<T1, U1, T2, U2, T3, U3, T4, U4>(
12 middleware: [Koa.Middleware<T1, U1>, Koa.Middleware<T2, U2>, Koa.Middleware<T3, U3>, Koa.Middleware<T4, U4>],
13): Koa.Middleware<T1 & T2 & T3 & T4, U1 & U2 & U3 & U4>;
14
15declare function compose<T1, U1, T2, U2, T3, U3, T4, U4, T5, U5>(
16 middleware: [
17 Koa.Middleware<T1, U1>,
18 Koa.Middleware<T2, U2>,
19 Koa.Middleware<T3, U3>,
20 Koa.Middleware<T4, U4>,
21 Koa.Middleware<T5, U5>,
22 ],
23): Koa.Middleware<T1 & T2 & T3 & T4 & T5, U1 & U2 & U3 & U4 & U5>;
24
25declare function compose<T1, U1, T2, U2, T3, U3, T4, U4, T5, U5, T6, U6>(
26 middleware: [
27 Koa.Middleware<T1, U1>,
28 Koa.Middleware<T2, U2>,
29 Koa.Middleware<T3, U3>,
30 Koa.Middleware<T4, U4>,
31 Koa.Middleware<T5, U5>,
32 Koa.Middleware<T6, U6>,
33 ],
34): Koa.Middleware<T1 & T2 & T3 & T4 & T5 & T6, U1 & U2 & U3 & U4 & U5 & U6>;
35
36declare function compose<T1, U1, T2, U2, T3, U3, T4, U4, T5, U5, T6, U6, T7, U7>(
37 middleware: [
38 Koa.Middleware<T1, U1>,
39 Koa.Middleware<T2, U2>,
40 Koa.Middleware<T3, U3>,
41 Koa.Middleware<T4, U4>,
42 Koa.Middleware<T5, U5>,
43 Koa.Middleware<T6, U6>,
44 Koa.Middleware<T7, U7>,
45 ],
46): Koa.Middleware<T1 & T2 & T3 & T4 & T5 & T6 & T7, U1 & U2 & U3 & U4 & U5 & U6 & U7>;
47
48declare function compose<T1, U1, T2, U2, T3, U3, T4, U4, T5, U5, T6, U6, T7, U7, T8, U8>(
49 middleware: [
50 Koa.Middleware<T1, U1>,
51 Koa.Middleware<T2, U2>,
52 Koa.Middleware<T3, U3>,
53 Koa.Middleware<T4, U4>,
54 Koa.Middleware<T5, U5>,
55 Koa.Middleware<T6, U6>,
56 Koa.Middleware<T7, U7>,
57 Koa.Middleware<T8, U8>,
58 ],
59): Koa.Middleware<T1 & T2 & T3 & T4 & T5 & T6 & T7 & T8, U1 & U2 & U3 & U4 & U5 & U6 & U7 & U8>;
60
61declare function compose<T>(middleware: Array<compose.Middleware<T>>): compose.ComposedMiddleware<T>;
62
63declare namespace compose {
64 type Middleware<T> = (context: T, next: Koa.Next) => any;
65 type ComposedMiddleware<T> = (context: T, next?: Koa.Next) => Promise<void>;
66}
67
68export = compose;