diff --git a/sources/Function/Compose/List/Async.ts b/sources/Function/Compose/List/Async.ts index 5b52c08b2..6d7f0eee0 100644 --- a/sources/Function/Compose/List/Async.ts +++ b/sources/Function/Compose/List/Async.ts @@ -2,6 +2,7 @@ import {Function} from '../../Function' import {Await} from '../../../Any/Await' +import {Curry} from '../../Curry' /** *@hidden @@ -11,7 +12,7 @@ export type ComposeListAsync = { R0, P extends any[], >(fns: [ - Function, + Function | Curry>, ]): Function>> < @@ -19,8 +20,8 @@ export type ComposeListAsync = { R1, P extends any[], >(fns: [ - Function<[Await], R1>, - Function, + Function<[Await], R1> | Curry], R1>>, + Function | Curry>, ]): Function>> < @@ -29,9 +30,9 @@ export type ComposeListAsync = { R2, P extends any[], >(fns: [ - Function<[Await], R2>, - Function<[Await], R1>, - Function, + Function<[Await], R2> | Curry], R2>>, + Function<[Await], R1> | Curry], R1>>, + Function | Curry>, ]): Function>> < @@ -41,10 +42,10 @@ export type ComposeListAsync = { R3, P extends any[], >(fns: [ - Function<[Await], R3>, - Function<[Await], R2>, - Function<[Await], R1>, - Function, + Function<[Await], R3> | Curry], R3>>, + Function<[Await], R2> | Curry], R2>>, + Function<[Await], R1> | Curry], R1>>, + Function | Curry>, ]): Function>> < @@ -55,11 +56,11 @@ export type ComposeListAsync = { R4, P extends any[], >(fns: [ - Function<[Await], R4>, - Function<[Await], R3>, - Function<[Await], R2>, - Function<[Await], R1>, - Function, + Function<[Await], R4> | Curry], R4>>, + Function<[Await], R3> | Curry], R3>>, + Function<[Await], R2> | Curry], R2>>, + Function<[Await], R1> | Curry], R1>>, + Function | Curry>, ]): Function>> < @@ -71,12 +72,12 @@ export type ComposeListAsync = { R5, P extends any[], >(fns: [ - Function<[Await], R5>, - Function<[Await], R4>, - Function<[Await], R3>, - Function<[Await], R2>, - Function<[Await], R1>, - Function, + Function<[Await], R5> | Curry], R5>>, + Function<[Await], R4> | Curry], R4>>, + Function<[Await], R3> | Curry], R3>>, + Function<[Await], R2> | Curry], R2>>, + Function<[Await], R1> | Curry], R1>>, + Function | Curry>, ]): Function>> < @@ -89,13 +90,13 @@ export type ComposeListAsync = { R6, P extends any[], >(fns: [ - Function<[Await], R6>, - Function<[Await], R5>, - Function<[Await], R4>, - Function<[Await], R3>, - Function<[Await], R2>, - Function<[Await], R1>, - Function, + Function<[Await], R6> | Curry], R6>>, + Function<[Await], R5> | Curry], R5>>, + Function<[Await], R4> | Curry], R4>>, + Function<[Await], R3> | Curry], R3>>, + Function<[Await], R2> | Curry], R2>>, + Function<[Await], R1> | Curry], R1>>, + Function | Curry>, ]): Function>> < @@ -109,14 +110,14 @@ export type ComposeListAsync = { R7, P extends any[], >(fns: [ - Function<[Await], R7>, - Function<[Await], R6>, - Function<[Await], R5>, - Function<[Await], R4>, - Function<[Await], R3>, - Function<[Await], R2>, - Function<[Await], R1>, - Function, + Function<[Await], R7> | Curry], R7>>, + Function<[Await], R6> | Curry], R6>>, + Function<[Await], R5> | Curry], R5>>, + Function<[Await], R4> | Curry], R4>>, + Function<[Await], R3> | Curry], R3>>, + Function<[Await], R2> | Curry], R2>>, + Function<[Await], R1> | Curry], R1>>, + Function | Curry>, ]): Function>> < @@ -131,15 +132,15 @@ export type ComposeListAsync = { R8, P extends any[], >(fns: [ - Function<[Await], R8>, - Function<[Await], R7>, - Function<[Await], R6>, - Function<[Await], R5>, - Function<[Await], R4>, - Function<[Await], R3>, - Function<[Await], R2>, - Function<[Await], R1>, - Function, + Function<[Await], R8> | Curry], R8>>, + Function<[Await], R7> | Curry], R7>>, + Function<[Await], R6> | Curry], R6>>, + Function<[Await], R5> | Curry], R5>>, + Function<[Await], R4> | Curry], R4>>, + Function<[Await], R3> | Curry], R3>>, + Function<[Await], R2> | Curry], R2>>, + Function<[Await], R1> | Curry], R1>>, + Function | Curry>, ]): Function>> < @@ -155,15 +156,15 @@ export type ComposeListAsync = { R9, P extends any[], >(fns: [ - Function<[Await], R9>, - Function<[Await], R8>, - Function<[Await], R7>, - Function<[Await], R6>, - Function<[Await], R5>, - Function<[Await], R4>, - Function<[Await], R3>, - Function<[Await], R2>, - Function<[Await], R1>, - Function, + Function<[Await], R9> | Curry], R9>>, + Function<[Await], R8> | Curry], R8>>, + Function<[Await], R7> | Curry], R7>>, + Function<[Await], R6> | Curry], R6>>, + Function<[Await], R5> | Curry], R5>>, + Function<[Await], R4> | Curry], R4>>, + Function<[Await], R3> | Curry], R3>>, + Function<[Await], R2> | Curry], R2>>, + Function<[Await], R1> | Curry], R1>>, + Function | Curry>, ]): Function>> } diff --git a/sources/Function/Compose/List/Sync.ts b/sources/Function/Compose/List/Sync.ts index 56121cbc8..670f3a77f 100644 --- a/sources/Function/Compose/List/Sync.ts +++ b/sources/Function/Compose/List/Sync.ts @@ -1,5 +1,6 @@ /** @ignore *//** */ +import {Curry} from '../../Curry' import {Function} from '../../Function' /** @@ -10,7 +11,7 @@ export type ComposeListSync = { R0, P extends any[], >(fns: [ - Function, + Function | Curry>, ]): Function < @@ -18,8 +19,8 @@ export type ComposeListSync = { R1, P extends any[], >(fns: [ - Function<[R0], R1>, - Function, + Function<[R0], R1> | Curry>, + Function | Curry>, ]): Function < @@ -28,9 +29,9 @@ export type ComposeListSync = { R2, P extends any[], >(fns: [ - Function<[R1], R2>, - Function<[R0], R1>, - Function, + Function<[R1], R2> | Curry>, + Function<[R0], R1> | Curry>, + Function | Curry>, ]): Function < @@ -40,10 +41,10 @@ export type ComposeListSync = { R3, P extends any[], >(fns: [ - Function<[R2], R3>, - Function<[R1], R2>, - Function<[R0], R1>, - Function, + Function<[R2], R3> | Curry>, + Function<[R1], R2> | Curry>, + Function<[R0], R1> | Curry>, + Function | Curry>, ]): Function < @@ -54,11 +55,11 @@ export type ComposeListSync = { R4, P extends any[], >(fns: [ - Function<[R3], R4>, - Function<[R2], R3>, - Function<[R1], R2>, - Function<[R0], R1>, - Function, + Function<[R3], R4> | Curry>, + Function<[R2], R3> | Curry>, + Function<[R1], R2> | Curry>, + Function<[R0], R1> | Curry>, + Function | Curry>, ]): Function < @@ -70,12 +71,12 @@ export type ComposeListSync = { R5, P extends any[], >(fns: [ - Function<[R4], R5>, - Function<[R3], R4>, - Function<[R2], R3>, - Function<[R1], R2>, - Function<[R0], R1>, - Function, + Function<[R4], R5> | Curry>, + Function<[R3], R4> | Curry>, + Function<[R2], R3> | Curry>, + Function<[R1], R2> | Curry>, + Function<[R0], R1> | Curry>, + Function | Curry>, ]): Function < @@ -88,13 +89,13 @@ export type ComposeListSync = { R6, P extends any[], >(fns: [ - Function<[R5], R6>, - Function<[R4], R5>, - Function<[R3], R4>, - Function<[R2], R3>, - Function<[R1], R2>, - Function<[R0], R1>, - Function, + Function<[R5], R6> | Curry>, + Function<[R4], R5> | Curry>, + Function<[R3], R4> | Curry>, + Function<[R2], R3> | Curry>, + Function<[R1], R2> | Curry>, + Function<[R0], R1> | Curry>, + Function | Curry>, ]): Function < @@ -108,14 +109,14 @@ export type ComposeListSync = { R7, P extends any[], >(fns: [ - Function<[R6], R7>, - Function<[R5], R6>, - Function<[R4], R5>, - Function<[R3], R4>, - Function<[R2], R3>, - Function<[R1], R2>, - Function<[R0], R1>, - Function, + Function<[R6], R7> | Curry>, + Function<[R5], R6> | Curry>, + Function<[R4], R5> | Curry>, + Function<[R3], R4> | Curry>, + Function<[R2], R3> | Curry>, + Function<[R1], R2> | Curry>, + Function<[R0], R1> | Curry>, + Function | Curry>, ]): Function < @@ -130,15 +131,15 @@ export type ComposeListSync = { R8, P extends any[], >(fns: [ - Function<[R7], R8>, - Function<[R6], R7>, - Function<[R5], R6>, - Function<[R4], R5>, - Function<[R3], R4>, - Function<[R2], R3>, - Function<[R1], R2>, - Function<[R0], R1>, - Function, + Function<[R7], R8> | Curry>, + Function<[R6], R7> | Curry>, + Function<[R5], R6> | Curry>, + Function<[R4], R5> | Curry>, + Function<[R3], R4> | Curry>, + Function<[R2], R3> | Curry>, + Function<[R1], R2> | Curry>, + Function<[R0], R1> | Curry>, + Function | Curry>, ]): Function < @@ -154,15 +155,15 @@ export type ComposeListSync = { R9, P extends any[], >(fns: [ - Function<[R8], R9>, - Function<[R7], R8>, - Function<[R6], R7>, - Function<[R5], R6>, - Function<[R4], R5>, - Function<[R3], R4>, - Function<[R2], R3>, - Function<[R1], R2>, - Function<[R0], R1>, - Function, + Function<[R8], R9> | Curry>, + Function<[R7], R8> | Curry>, + Function<[R6], R7> | Curry>, + Function<[R5], R6> | Curry>, + Function<[R4], R5> | Curry>, + Function<[R3], R4> | Curry>, + Function<[R2], R3> | Curry>, + Function<[R1], R2> | Curry>, + Function<[R0], R1> | Curry>, + Function | Curry>, ]): Function } diff --git a/sources/Function/Compose/Multi/Async.ts b/sources/Function/Compose/Multi/Async.ts index 0b744a258..2f6ad4cd4 100644 --- a/sources/Function/Compose/Multi/Async.ts +++ b/sources/Function/Compose/Multi/Async.ts @@ -2,6 +2,7 @@ import {Function} from '../../Function' import {Await} from '../../../Any/Await' +import {Curry} from '../../Curry' /** *@hidden @@ -11,7 +12,7 @@ export type ComposeMultiAsync = { R0, P extends any[], >(...fns: [ - Function, + Function | Curry>, ]): Function>> < @@ -19,8 +20,8 @@ export type ComposeMultiAsync = { R1, P extends any[], >(...fns: [ - Function<[Await], R1>, - Function, + Function<[Await], R1> | Curry], R1>>, + Function | Curry>, ]): Function>> < @@ -29,9 +30,9 @@ export type ComposeMultiAsync = { R2, P extends any[], >(...fns: [ - Function<[Await], R2>, - Function<[Await], R1>, - Function, + Function<[Await], R2> | Curry], R2>>, + Function<[Await], R1> | Curry], R1>>, + Function | Curry>, ]): Function>> < @@ -41,10 +42,10 @@ export type ComposeMultiAsync = { R3, P extends any[], >(...fns: [ - Function<[Await], R3>, - Function<[Await], R2>, - Function<[Await], R1>, - Function, + Function<[Await], R3> | Curry], R3>>, + Function<[Await], R2> | Curry], R2>>, + Function<[Await], R1> | Curry], R1>>, + Function | Curry>, ]): Function>> < @@ -55,11 +56,11 @@ export type ComposeMultiAsync = { R4, P extends any[], >(...fns: [ - Function<[Await], R4>, - Function<[Await], R3>, - Function<[Await], R2>, - Function<[Await], R1>, - Function, + Function<[Await], R4> | Curry], R4>>, + Function<[Await], R3> | Curry], R3>>, + Function<[Await], R2> | Curry], R2>>, + Function<[Await], R1> | Curry], R1>>, + Function | Curry>, ]): Function>> < @@ -71,12 +72,12 @@ export type ComposeMultiAsync = { R5, P extends any[], >(...fns: [ - Function<[Await], R5>, - Function<[Await], R4>, - Function<[Await], R3>, - Function<[Await], R2>, - Function<[Await], R1>, - Function, + Function<[Await], R5> | Curry], R5>>, + Function<[Await], R4> | Curry], R4>>, + Function<[Await], R3> | Curry], R3>>, + Function<[Await], R2> | Curry], R2>>, + Function<[Await], R1> | Curry], R1>>, + Function | Curry>, ]): Function>> < @@ -89,13 +90,13 @@ export type ComposeMultiAsync = { R6, P extends any[], >(...fns: [ - Function<[Await], R6>, - Function<[Await], R5>, - Function<[Await], R4>, - Function<[Await], R3>, - Function<[Await], R2>, - Function<[Await], R1>, - Function, + Function<[Await], R6> | Curry], R6>>, + Function<[Await], R5> | Curry], R5>>, + Function<[Await], R4> | Curry], R4>>, + Function<[Await], R3> | Curry], R3>>, + Function<[Await], R2> | Curry], R2>>, + Function<[Await], R1> | Curry], R1>>, + Function | Curry>, ]): Function>> < @@ -109,14 +110,14 @@ export type ComposeMultiAsync = { R7, P extends any[], >(...fns: [ - Function<[Await], R7>, - Function<[Await], R6>, - Function<[Await], R5>, - Function<[Await], R4>, - Function<[Await], R3>, - Function<[Await], R2>, - Function<[Await], R1>, - Function, + Function<[Await], R7> | Curry], R7>>, + Function<[Await], R6> | Curry], R6>>, + Function<[Await], R5> | Curry], R5>>, + Function<[Await], R4> | Curry], R4>>, + Function<[Await], R3> | Curry], R3>>, + Function<[Await], R2> | Curry], R2>>, + Function<[Await], R1> | Curry], R1>>, + Function | Curry>, ]): Function>> < @@ -131,15 +132,15 @@ export type ComposeMultiAsync = { R8, P extends any[], >(...fns: [ - Function<[Await], R8>, - Function<[Await], R7>, - Function<[Await], R6>, - Function<[Await], R5>, - Function<[Await], R4>, - Function<[Await], R3>, - Function<[Await], R2>, - Function<[Await], R1>, - Function, + Function<[Await], R8> | Curry], R8>>, + Function<[Await], R7> | Curry], R7>>, + Function<[Await], R6> | Curry], R6>>, + Function<[Await], R5> | Curry], R5>>, + Function<[Await], R4> | Curry], R4>>, + Function<[Await], R3> | Curry], R3>>, + Function<[Await], R2> | Curry], R2>>, + Function<[Await], R1> | Curry], R1>>, + Function | Curry>, ]): Function>> < @@ -155,15 +156,15 @@ export type ComposeMultiAsync = { R9, P extends any[], >(...fns: [ - Function<[Await], R9>, - Function<[Await], R8>, - Function<[Await], R7>, - Function<[Await], R6>, - Function<[Await], R5>, - Function<[Await], R4>, - Function<[Await], R3>, - Function<[Await], R2>, - Function<[Await], R1>, - Function, + Function<[Await], R9> | Curry], R9>>, + Function<[Await], R8> | Curry], R8>>, + Function<[Await], R7> | Curry], R7>>, + Function<[Await], R6> | Curry], R6>>, + Function<[Await], R5> | Curry], R5>>, + Function<[Await], R4> | Curry], R4>>, + Function<[Await], R3> | Curry], R3>>, + Function<[Await], R2> | Curry], R2>>, + Function<[Await], R1> | Curry], R1>>, + Function | Curry>, ]): Function>> } diff --git a/sources/Function/Compose/Multi/Sync.ts b/sources/Function/Compose/Multi/Sync.ts index 67503d1a0..e1ed6f193 100644 --- a/sources/Function/Compose/Multi/Sync.ts +++ b/sources/Function/Compose/Multi/Sync.ts @@ -1,6 +1,7 @@ /** @ignore *//** */ +import {Curry} from '../../Curry' import {Function} from '../../Function' /** @@ -11,7 +12,7 @@ export type ComposeMultiSync = { R0, P extends any[], >(...fns: [ - Function, + Function | Curry>, ]): Function < @@ -19,8 +20,8 @@ export type ComposeMultiSync = { R1, P extends any[], >(...fns: [ - Function<[R0], R1>, - Function, + Function<[R0], R1> | Curry>, + Function | Curry>, ]): Function < @@ -29,9 +30,9 @@ export type ComposeMultiSync = { R2, P extends any[], >(...fns: [ - Function<[R1], R2>, - Function<[R0], R1>, - Function, + Function<[R1], R2> | Curry>, + Function<[R0], R1> | Curry>, + Function | Curry>, ]): Function < @@ -41,10 +42,10 @@ export type ComposeMultiSync = { R3, P extends any[], >(...fns: [ - Function<[R2], R3>, - Function<[R1], R2>, - Function<[R0], R1>, - Function, + Function<[R2], R3> | Curry>, + Function<[R1], R2> | Curry>, + Function<[R0], R1> | Curry>, + Function | Curry>, ]): Function < @@ -55,11 +56,11 @@ export type ComposeMultiSync = { R4, P extends any[], >(...fns: [ - Function<[R3], R4>, - Function<[R2], R3>, - Function<[R1], R2>, - Function<[R0], R1>, - Function, + Function<[R3], R4> | Curry>, + Function<[R2], R3> | Curry>, + Function<[R1], R2> | Curry>, + Function<[R0], R1> | Curry>, + Function | Curry>, ]): Function < @@ -71,12 +72,12 @@ export type ComposeMultiSync = { R5, P extends any[], >(...fns: [ - Function<[R4], R5>, - Function<[R3], R4>, - Function<[R2], R3>, - Function<[R1], R2>, - Function<[R0], R1>, - Function, + Function<[R4], R5> | Curry>, + Function<[R3], R4> | Curry>, + Function<[R2], R3> | Curry>, + Function<[R1], R2> | Curry>, + Function<[R0], R1> | Curry>, + Function | Curry>, ]): Function < @@ -89,13 +90,13 @@ export type ComposeMultiSync = { R6, P extends any[], >(...fns: [ - Function<[R5], R6>, - Function<[R4], R5>, - Function<[R3], R4>, - Function<[R2], R3>, - Function<[R1], R2>, - Function<[R0], R1>, - Function, + Function<[R5], R6> | Curry>, + Function<[R4], R5> | Curry>, + Function<[R3], R4> | Curry>, + Function<[R2], R3> | Curry>, + Function<[R1], R2> | Curry>, + Function<[R0], R1> | Curry>, + Function | Curry>, ]): Function < @@ -109,14 +110,14 @@ export type ComposeMultiSync = { R7, P extends any[], >(...fns: [ - Function<[R6], R7>, - Function<[R5], R6>, - Function<[R4], R5>, - Function<[R3], R4>, - Function<[R2], R3>, - Function<[R1], R2>, - Function<[R0], R1>, - Function, + Function<[R6], R7> | Curry>, + Function<[R5], R6> | Curry>, + Function<[R4], R5> | Curry>, + Function<[R3], R4> | Curry>, + Function<[R2], R3> | Curry>, + Function<[R1], R2> | Curry>, + Function<[R0], R1> | Curry>, + Function | Curry>, ]): Function < @@ -131,15 +132,15 @@ export type ComposeMultiSync = { R8, P extends any[], >(...fns: [ - Function<[R7], R8>, - Function<[R6], R7>, - Function<[R5], R6>, - Function<[R4], R5>, - Function<[R3], R4>, - Function<[R2], R3>, - Function<[R1], R2>, - Function<[R0], R1>, - Function, + Function<[R7], R8> | Curry>, + Function<[R6], R7> | Curry>, + Function<[R5], R6> | Curry>, + Function<[R4], R5> | Curry>, + Function<[R3], R4> | Curry>, + Function<[R2], R3> | Curry>, + Function<[R1], R2> | Curry>, + Function<[R0], R1> | Curry>, + Function | Curry>, ]): Function < @@ -155,15 +156,15 @@ export type ComposeMultiSync = { R9, P extends any[], >(...fns: [ - Function<[R8], R9>, - Function<[R7], R8>, - Function<[R6], R7>, - Function<[R5], R6>, - Function<[R4], R5>, - Function<[R3], R4>, - Function<[R2], R3>, - Function<[R1], R2>, - Function<[R0], R1>, - Function, + Function<[R8], R9> | Curry>, + Function<[R7], R8> | Curry>, + Function<[R6], R7> | Curry>, + Function<[R5], R6> | Curry>, + Function<[R4], R5> | Curry>, + Function<[R3], R4> | Curry>, + Function<[R2], R3> | Curry>, + Function<[R1], R2> | Curry>, + Function<[R0], R1> | Curry>, + Function | Curry>, ]): Function } diff --git a/tests/Function.ts b/tests/Function.ts index 110e86a97..87203e52c 100644 --- a/tests/Function.ts +++ b/tests/Function.ts @@ -1,5 +1,4 @@ import {Test, F, A} from '../sources' -import {Key} from '../sources/Any/Key' const {checks, check} = Test @@ -31,6 +30,12 @@ const composedSync = composeSync( (name: string, age: number) => ({name, age}), // receive parameters ) +composeSync( + (c1: string[]) => [c1], + (b1: string) => [b1], + curry((a1: number, d2: number) => `${a1 + d2}`), +)(23, 42) + checks([ check<(typeof composedSync), (name: string, age: number) => boolean, Test.Pass>(), ]) @@ -47,6 +52,12 @@ const composedAsync = composeAsync( async (name: string, age: number) => ({name, age}), // receive parameters ) +composeAsync( + (c1: string[]) => [c1], + (b1: string) => [b1], + curry((a1: number, d2: number) => `${a1 + d2}`), +)(23, 42) + checks([ check<(typeof composedAsync), (name: string, age: number) => Promise, Test.Pass>(), ]) @@ -196,6 +207,12 @@ const pipedAsync = pipeAsync( (message: string) => false, // receive previous return ) +pipeAsync( + curry((a1: number, d2: number) => `${a1 + d2}`), + (b1: string) => [b1], + (c1: string[]) => [c1], +)(23, 42) + checks([ check<(typeof pipedAsync), (name: string, age: number) => Promise, Test.Pass>(), ])