import type { Abortable } from '../abortable/Abortable';
import type { AnyExecutionContext } from '../execution-context/ExecutionContext';
export type Task<Context extends AnyExecutionContext, P, R> = (parameter: P, context: Context) => R | PromiseLike<R> | Abortable<R>;
export type TaskParam<T> = T extends NamedTask<infer S> ? S extends Task<AnyExecutionContext, infer P, any> ? P : never : never;
export type TaskReturn<T> = T extends NamedTask<infer S> ? S extends Task<AnyExecutionContext, any, infer R> ? Awaited<R> : never : never;
export type NamedTask<T extends AnyTask> = T & {
    _name: string;
};
export type BoundTask<T extends NamedTask<AnyTask>> = (param: TaskParam<T>) => Abortable<TaskReturn<T>>;
export type AnyTask = Task<any, any, any>;
export type AnyContextTask<Ctx extends AnyExecutionContext> = Task<Ctx, any, any>;
export type AnyParameterTask<P> = Task<any, P, any>;
export type AnyNamedTask = NamedTask<AnyTask>;
