Skip to main content

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