Class Task<T, ReqENV, ProvEnv, Err, Async>
Type parameters
-
T
-
ReqENV: Object = {}
-
ProvEnv: Object = {}
-
Err: unknown = Error
-
Async: boolean = false
Accessors
Static empty
- get empty(): Task<unknown, {}, {}, Error, false>
-
Returns Task<unknown, {}, {}, Error, false>
Methods
access
- access<E>(): Task<E extends Promise<Z> ? Z : E, E, ProvEnv, Err, E extends Promise<Z> ? true : Async>
-
Type parameters
Returns Task<E extends Promise<Z> ? Z : E, E, ProvEnv, Err, E extends Promise<Z> ? true : Async>
chain
- chain<NT, NRE, NPE, NER, A, NA>(fn: (value: T) => Task<NT, NRE, NPE, NER, A>): Task<NT extends Promise<Z> ? Z : NT, ReqENV & NRE, ProvEnv & NPE, NER, NT extends Promise<Z> ? true : NA>
-
Type parameters
-
NT
-
NRE
-
NPE
-
NER
-
A: boolean
-
NA: boolean = Async extends true ? true : A
Parameters
-
fn: (value: T) => Task<NT, NRE, NPE, NER, A>
-
- (value: T): Task<NT, NRE, NPE, NER, A>
-
Parameters
Returns Task<NT, NRE, NPE, NER, A>
Returns Task<NT extends Promise<Z> ? Z : NT, ReqENV & NRE, ProvEnv & NPE, NER, NT extends Promise<Z> ? true : NA>
collectAll
- collectAll(): Task<T[], ReqENV, ProvEnv, Err, Async>
-
Returns Task<T[], ReqENV, ProvEnv, Err, Async>
collectWhen
- collectWhen(fn: (item: T) => boolean): Task<T[], ReqENV, ProvEnv, Err, Async>
-
Parameters
-
fn: (item: T) => boolean
-
-
Parameters
Returns boolean
Returns Task<T[], ReqENV, ProvEnv, Err, Async>
delay
- delay(time: number): Task<T extends Promise<Z> ? Z : T, ReqENV, ProvEnv, Err, T extends Promise<Z> ? true : Async>
-
Parameters
Returns Task<T extends Promise<Z> ? Z : T, ReqENV, ProvEnv, Err, T extends Promise<Z> ? true : Async>
ensure
- ensure(handler: (value: T) => any): Task<T, ReqENV, ProvEnv, Err, Async>
-
Parameters
-
handler: (value: T) => any
Returns Task<T, ReqENV, ProvEnv, Err, Async>
fromCallback
- fromCallback<T>(fn: (cb: (value: T) => void) => unknown): Task<T extends Promise<Z> ? Z : T, ReqENV, ProvEnv, Err, T extends Promise<Z> ? true : true>
-
Type parameters
Parameters
-
fn: (cb: (value: T) => void) => unknown
-
- (cb: (value: T) => void): unknown
-
Parameters
Returns unknown
Returns Task<T extends Promise<Z> ? Z : T, ReqENV, ProvEnv, Err, T extends Promise<Z> ? true : true>
map
- map<R>(fn: (value: T) => R): Task<R extends Promise<Z> ? Z : R, ReqENV, ProvEnv, Err, R extends Promise<Z> ? true : Async>
-
Type parameters
Parameters
Returns Task<R extends Promise<Z> ? Z : R, ReqENV, ProvEnv, Err, R extends Promise<Z> ? true : Async>
mapError
- mapError<NE>(fn: (value: Err) => NE): Task<T extends Promise<Z> ? Z : T, ReqENV, ProvEnv, NE, T extends Promise<Z> ? true : Async>
-
Type parameters
Parameters
Returns Task<T extends Promise<Z> ? Z : T, ReqENV, ProvEnv, NE, T extends Promise<Z> ? true : Async>
mapTo
- mapTo<R>(value: R): Task<R extends Promise<Z> ? Z : R, ReqENV, ProvEnv, Err, R extends Promise<Z> ? true : Async>
-
Type parameters
Parameters
Returns Task<R extends Promise<Z> ? Z : R, ReqENV, ProvEnv, Err, R extends Promise<Z> ? true : Async>
provide
- provide<E>(env: E): Task<T extends Promise<Z> ? Z : T, ReqENV, ProvEnv & E, Err, T extends Promise<Z> ? true : Async>
-
Type parameters
Parameters
Returns Task<T extends Promise<Z> ? Z : T, ReqENV, ProvEnv & E, Err, T extends Promise<Z> ? true : Async>
reduce
- reduce<R>(fn: (value: T, current: R) => R, initial: R): Task<R extends Promise<Z> ? Z : R, ReqENV, ProvEnv, Err, R extends Promise<Z> ? true : Async>
-
Type parameters
Parameters
-
fn: (value: T, current: R) => R
-
- (value: T, current: R): R
-
initial: R
Returns Task<R extends Promise<Z> ? Z : R, ReqENV, ProvEnv, Err, R extends Promise<Z> ? true : Async>
repeat
- repeat(count: number): Task<T extends Promise<Z> ? Z : T, ReqENV, ProvEnv, Err, T extends Promise<Z> ? true : Async>
-
Parameters
Returns Task<T extends Promise<Z> ? Z : T, ReqENV, ProvEnv, Err, T extends Promise<Z> ? true : Async>
repeatWhile
- repeatWhile<U>(fn: U): Task<T extends Promise<Z> ? Z : T, ReqENV, ProvEnv, Err, T extends Promise<Z> ? true : Async>
-
Type parameters
Parameters
Returns Task<T extends Promise<Z> ? Z : T, ReqENV, ProvEnv, Err, T extends Promise<Z> ? true : Async>
retryWhile
- retryWhile(fn: () => boolean): Task<T, ReqENV, ProvEnv, Err, Async>
-
Parameters
Returns Task<T, ReqENV, ProvEnv, Err, Async>
run
- run<R>(..._: ProvEnv extends ReqENV ? EmptyArray : [Errors: {[ k in string | number | symbol]: DiffErr<ReqENV, ProvEnv>[k] }]): R
-
Type parameters
-
R = Async extends true ? Promise<T> : Result<T> | Fail<Err>
Parameters
-
Rest ..._: ProvEnv extends ReqENV ? EmptyArray : [Errors: {[ k in string | number | symbol]: DiffErr<ReqENV, ProvEnv>[k] }]
Returns R
runUnsafe
- runUnsafe<R>(..._: ProvEnv extends ReqENV ? EmptyArray : [Errors: {[ k in string | number | symbol]: DiffErr<ReqENV, ProvEnv>[k] }]): R
-
Type parameters
-
R = Async extends true ? Promise<T> : T
Parameters
-
Rest ..._: ProvEnv extends ReqENV ? EmptyArray : [Errors: {[ k in string | number | symbol]: DiffErr<ReqENV, ProvEnv>[k] }]
Returns R
structPar
- structPar<T, R, RENV, PENV, Err, A>(struct: T): Task<R extends Promise<Z> ? Z : R, RENV, PENV, Err, R extends Promise<Z> ? true : A>
-
Type parameters
-
T: Record<string, Task<any, any, {}, Error, false>>
-
R: TaskValue<T>
-
RENV: Object
-
PENV: Object
-
Err: unknown
-
A: boolean
Parameters
Returns Task<R extends Promise<Z> ? Z : R, RENV, PENV, Err, R extends Promise<Z> ? true : A>
tap
- tap<R>(fn: (value: T) => R): Task<T extends Promise<Z> ? Z : T, ReqENV, ProvEnv, Err, T extends Promise<Z> ? true : Async>
-
Type parameters
Parameters
Returns Task<T extends Promise<Z> ? Z : T, ReqENV, ProvEnv, Err, T extends Promise<Z> ? true : Async>
tapChain
- tapChain<NT, NRE, NPE, NER, A, NA>(fn: (value: T) => Task<NT, NRE, NPE, NER, A>): Task<T extends Promise<Z> ? Z : T, ReqENV & NRE, ProvEnv & NPE, NER, T extends Promise<Z> ? true : NA>
-
Type parameters
-
NT
-
NRE
-
NPE
-
NER
-
A: boolean
-
NA: boolean = Async extends true ? true : A
Parameters
-
fn: (value: T) => Task<NT, NRE, NPE, NER, A>
-
- (value: T): Task<NT, NRE, NPE, NER, A>
-
Parameters
Returns Task<NT, NRE, NPE, NER, A>
Returns Task<T extends Promise<Z> ? Z : T, ReqENV & NRE, ProvEnv & NPE, NER, T extends Promise<Z> ? true : NA>
timeout
- timeout(max: number): Task<T extends Promise<Z> ? Z : T, ReqENV, ProvEnv, TimeOutError | Err, T extends Promise<Z> ? true : Async>
-
Parameters
Returns Task<T extends Promise<Z> ? Z : T, ReqENV, ProvEnv, TimeOutError | Err, T extends Promise<Z> ? true : Async>
Static fail
- fail<ERR>(err: ERR): Task<Error, {}, {}, ERR, false>
-
Type parameters
Parameters
Returns Task<Error, {}, {}, ERR, false>
Static fromCallback
- fromCallback<T>(fn: (cb: (value: T) => void) => unknown): Task<T extends Promise<Z> ? Z : T, {}, {}, Error, T extends Promise<Z> ? true : true>
-
Type parameters
Parameters
-
fn: (cb: (value: T) => void) => unknown
-
- (cb: (value: T) => void): unknown
-
Parameters
Returns unknown
Returns Task<T extends Promise<Z> ? Z : T, {}, {}, Error, T extends Promise<Z> ? true : true>
Static sequenceFromIterable
- sequenceFromIterable<R>(itererable: Iterable<R> | AsyncIterable<R>): Task<R extends Promise<Z> ? Z : R, {}, {}, Error, R extends Promise<Z> ? true : false>
-
Type parameters
Parameters
-
itererable: Iterable<R> | AsyncIterable<R>
Returns Task<R extends Promise<Z> ? Z : R, {}, {}, Error, R extends Promise<Z> ? true : false>
Static sequenceFromObject
- sequenceFromObject<T, R>(obj: T): Task<R extends Promise<Z> ? Z : R, {}, {}, Error, R extends Promise<Z> ? true : false>
-
Type parameters
-
T: Object
-
R: [keyof T, T[keyof T]]
Parameters
Returns Task<R extends Promise<Z> ? Z : R, {}, {}, Error, R extends Promise<Z> ? true : false>
Static sequenceGen
- sequenceGen<T>(fn: () => Generator<T, void, unknown> | AsyncGenerator<T, void, unknown>): Task<T extends Promise<Z> ? Z : T, {}, {}, Error, T extends Promise<Z> ? true : false>
-
Type parameters
Parameters
-
fn: () => Generator<T, void, unknown> | AsyncGenerator<T, void, unknown>
-
- (): Generator<T, void, unknown> | AsyncGenerator<T, void, unknown>
-
Returns Generator<T, void, unknown> | AsyncGenerator<T, void, unknown>
Returns Task<T extends Promise<Z> ? Z : T, {}, {}, Error, T extends Promise<Z> ? true : false>
Static struct
- struct<T, R, RENV, PENV, Err, A>(struct: T): Task<TaskValue<T> extends Promise<Z> ? Z : TaskValue<T>, TaskReqEnv<T>, TaskProvEnv<T>, TaskError<T>, TaskValue<T> extends Promise<Z> ? true : TaskAsync<T>>
-
Type parameters
-
T: Record<string, Task<any, any, {}, Error, false>>
-
R: TaskValue<T>
-
RENV: Object
-
PENV: Object
-
Err: unknown
-
A: boolean
Parameters
Returns Task<TaskValue<T> extends Promise<Z> ? Z : TaskValue<T>, TaskReqEnv<T>, TaskProvEnv<T>, TaskError<T>, TaskValue<T> extends Promise<Z> ? true : TaskAsync<T>>
Static structPar
- structPar<T, R, RENV, PENV, Err, A>(struct: T): Task<TaskValue<T> extends Promise<Z> ? Z : TaskValue<T>, TaskReqEnv<T>, TaskProvEnv<T>, TaskError<T>, TaskValue<T> extends Promise<Z> ? true : TaskAsync<T>>
-
Type parameters
-
T: Record<string, Task<any, any, {}, Error, false>>
-
R: TaskValue<T>
-
RENV: Object
-
PENV: Object
-
Err: unknown
-
A: boolean
Parameters
Returns Task<TaskValue<T> extends Promise<Z> ? Z : TaskValue<T>, TaskReqEnv<T>, TaskProvEnv<T>, TaskError<T>, TaskValue<T> extends Promise<Z> ? true : TaskAsync<T>>
Static succeed
- succeed<T>(value: T): Task<T extends Promise<Z> ? Z : T, {}, {}, Error, T extends Promise<Z> ? true : false>
-
Type parameters
Parameters
Returns Task<T extends Promise<Z> ? Z : T, {}, {}, Error, T extends Promise<Z> ? true : false>
Required dependencies