import { MaybeAsync } from '../types';
export interface ICancelable {
    cancel(err?: Error): Promise<void>;
    isCancelled: () => boolean;
}
export type Cancelable<T extends object> = T & ICancelable;
export type MaybeCancelable<T extends object> = T | Cancelable<T>;
/**
 * Allows injecting a function to execute after an iterator finishes.
 * Executes finally function even if generator not started.
 * Returns new generator.
 */
type OnFinallyFn = MaybeAsync<(err?: Error) => void>;
export declare function iteratorFinally<T>(iterable: MaybeCancelable<AsyncIterable<T> | AsyncGenerator<T>>, onFinally?: OnFinallyFn): AsyncGenerator<T, any, unknown>;
export declare const nextValue: <T>(source: AsyncIterator<T>) => Promise<T | undefined>;
export {};
