Aller au contenu principal

bind()

bind<N, A, E2, B>(name, f): <E1>(fa) => Either<E2 | E1, { readonly [K in string | number | symbol]: K extends keyof A ? A[K<K>] : B }>

Binds a computed value to a name in do notation.


Type Parameters

N: N extends string

The property name.

A: A extends Record<string, unknown>

The accumulated type.

E2: E2

The error type.

B: B

The new value type.


Parameters

name: Exclude<N, keyof A>

The property name.

f: (a) => Either<E2, B>

The function to compute the value.


Returns: <E1>(fa): Either<E2 | E1, { readonly [K in string | number | symbol]: K extends keyof A ? A[K<K>] : B }>

A function that binds the computed value.


Since

2.0.0