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
This commit is contained in:
Evan Yamanishi
2019-04-05 13:18:34 -04:00
parent 467db4e466
commit f69bf7971f

View File

@@ -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<never> | 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.