From f69bf7971fb1bda57f1d77a67c4a3d18de36388c Mon Sep 17 00:00:00 2001 From: Evan Yamanishi Date: Fri, 5 Apr 2019 13:18:34 -0400 Subject: [PATCH] feat(undertaker): task returns a wrapped fn Undertaker's task setter wraps the original function: https://github.com/gulpjs/undertaker/blob/master/lib/set-task.js --- types/undertaker/index.d.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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.