import "./_dnt.polyfills.js"; import type { PromiseMaybe } from "./promise.js"; /** * GeneratorFunction */ export declare const GF: GeneratorFunction; /** * AsyncGeneratorFunction */ export declare const AGF: AsyncGeneratorFunction; type AGValue = T extends AsyncIterableIterator ? V : unknown; type AGReturn = T extends AsyncIterableIterator ? R : unknown; type AGNext = T extends AsyncIterableIterator ? N : unknown; /** * 持续迭代一个异步迭代器直到结束 * @example * ```ts * // const r: number * const r = await ag_done((async function* () { * return 1; * })()); * ``` */ export declare const ag_done: >(ag: T, each?: AsyncGeneratorDoneOptions) => Promise>; export interface AsyncGeneratorDoneOptions> { next?: (value: AGValue) => PromiseMaybe>; } export declare const ag_map: , R>(ag: T, each: AsyncGeneratorMapOptions) => Promise; export interface AsyncGeneratorMapOptions, R> extends AsyncGeneratorDoneOptions { map: (value: AGValue) => PromiseMaybe; } export declare const ag_map_reduce: , M, R>(ag: T, each: AsyncGeneratorMapReduceOptions) => Promise; export interface AsyncGeneratorMapReduceOptions, M, R> extends AsyncGeneratorDoneOptions { map: (value: AGValue) => PromiseMaybe>; reduce: (previousValue: R, currentValue: M) => PromiseMaybe; initialValue: R; } /** * 持续迭代一个异步迭代器直到结束,接受 promise.then 的参数 * * @example * ```ts * // const r: 1 | boolean * const r = await ag_then( * (async function* () { * })(), * () => 1 as const, * () => false, * ); * ``` */ export declare const ag_then: , ARGS extends Parameters>["then"]> = [onfulfilled?: ((value: any) => unknown | PromiseLike) | null | undefined, onrejected?: ((reason: any) => unknown | PromiseLike) | null | undefined]>(ag: T, ...args: ARGS) => Promise[number]>>; type FilterNotNull = A extends (infer T)[] ? NonNullable[] : []; export {}; //# sourceMappingURL=generator.d.ts.map