Skip to content

TypeScript API / laikacms/core / AsyncGenerator

Variable: AsyncGenerator ​

ts
const AsyncGenerator: object;

AsyncGenerator helpers. Split out of utilities.ts on purpose: accumulateFirst needs effect/Result, and keeping it in utilities made every consumer of a trivial helper (memoize, Url, ...) drag the effect graph into its bundle. utilities.ts must stay dependency-free - add anything that imports effect (or any other runtime dep) HERE or in its own module, never there.

Type Declaration ​

accumulateFirst ​

ts
accumulateFirst: <T>(gen) => Promise<Result<T, LaikaError<ErrorCode, number>[]>>;

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterType
genAsyncGenerator<LaikaResult<T>>

Returns ​

Promise<Result<T, LaikaError<ErrorCode, number>[]>>

first ​

ts
first: <T>(gen) => Promise<T | undefined>;

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterType
genAsyncGenerator<T>

Returns ​

Promise<T | undefined>

toArray ​

ts
toArray: <T>(gen) => Promise<T[]>;

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterType
genAsyncGenerator<T>

Returns ​

Promise<T[]>

Released under the MIT License.