Configuration for creating a Task.

interface TaskConfig<TSpec extends TaskSpec> {
    execute: (
        this: Task<TSpec>,
        data: TSpec["TData"],
    ) => TSpec["TResult"] | Promise<TSpec["TResult"]>;
    name: string;
    parse?: (this: Task<TSpec>) => undefined | ParsedTask;
}

Type Parameters

  • TSpec extends TaskSpec

    Task specification type.

Properties

Properties

execute: (
    this: Task<TSpec>,
    data: TSpec["TData"],
) => TSpec["TResult"] | Promise<TSpec["TResult"]>

Function to execute the task, returning a result or a promise.

name: string

Name of the task.

parse?: (this: Task<TSpec>) => undefined | ParsedTask

Function to parse the task's outcome into a ParsedTask.