diff --git a/types/undertaker/index.d.ts b/types/undertaker/index.d.ts index 7c7cd5c1ab..bd483c2b6a 100644 --- a/types/undertaker/index.d.ts +++ b/types/undertaker/index.d.ts @@ -19,12 +19,19 @@ declare namespace Undertaker { [arg: string]: string; } - interface TaskFunction extends TaskFunctionParams { + interface TaskFunctionBase { (done: (error?: any) => void): void | Duplex | NodeJS.Process | Promise | any; } + interface TaskFunction extends TaskFunctionBase, TaskFunctionParams {} + type Task = string | TaskFunction; + interface TaskFunctionWrapped extends TaskFunctionBase { + displayName: string; + unwrap(): TaskFunction; + } + interface TreeOptions { /** * Whether or not the whole tree should be returned. @@ -50,10 +57,10 @@ declare class Undertaker extends EventEmitter { constructor(registry?: Registry); /** - * Returns the registered function. + * Returns the wrapped registered function. * @param taskName - Task name. */ - task(taskName: string): Undertaker.TaskFunction; + task(taskName: string): Undertaker.TaskFunctionWrapped; /** * Register the task by the taskName.