Skip to content

Commit

Permalink
Move tag to the ComposableFunction type
Browse files Browse the repository at this point in the history
  • Loading branch information
diogob committed Jul 14, 2024
1 parent f8fa638 commit 573a41d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ type MergeObjects<Objs extends unknown[], output = {}> = Objs extends [
* We only use this type to make the Composable type neater looking.
* It does not need to be exported by the library.
*/
type ComposableFunction<T extends Internal.AnyFn = Internal.AnyFn> = (
...args: Parameters<T>
) => Promise<Result<Awaited<ReturnType<T>>>>
type ComposableFunction<T extends Internal.AnyFn = Internal.AnyFn> = {
(
...args: Parameters<T>
): Promise<Result<Awaited<ReturnType<T>>>>
kind: 'composable'
}

/**
* A composable async function that catches failures.
*/
type Composable<T extends Internal.AnyFn = Internal.AnyFn> = T extends {
kind: 'composable'
} ? T
: ComposableFunction<T> & {
kind: 'composable'
}

: ComposableFunction<T>
/**
* A composable async function with schema validation at runtime.
*/
Expand Down

0 comments on commit 573a41d

Please sign in to comment.