diff --git a/types/gulp/gulp-tests.ts b/types/gulp/gulp-tests.ts
index 9660b0658a..809ffed350 100644
--- a/types/gulp/gulp-tests.ts
+++ b/types/gulp/gulp-tests.ts
@@ -27,6 +27,9 @@ gulp.task('test', ['compile', 'compile2'], function()
gulp.task('default', ['compile', 'test']);
+gulp.task('another', ['with1', 'with2'])
+ .task('some', ['other1', 'other2'], function(cb) { cb(null); })
+ .task('last', function() { });
var opts = {};
diff --git a/types/gulp/index.d.ts b/types/gulp/index.d.ts
index fefd5b0fda..2a7579ec1f 100644
--- a/types/gulp/index.d.ts
+++ b/types/gulp/index.d.ts
@@ -14,6 +14,7 @@ declare type Strings = string|string[];
declare namespace gulp {
interface Gulp extends Orchestrator {
+ task(name: string): never;
/**
* Define a task
* @param name The name of the task.
@@ -24,7 +25,19 @@ declare namespace gulp {
*
Return a stream or a promise
*
*/
- task: Orchestrator.AddMethod;
+ task(name: string, fn?: Orchestrator.TaskFunc): Gulp;
+ /**
+ * Define a task
+ * @param name The name of the task.
+ * @param deps An array of task names to be executed and completed before your task will run.
+ * @param fn The function that performs the task's operations. For asynchronous tasks, you need to provide a hint when the task is complete:
+ *
+ * - Take in a callback
+ * - Return a stream or a promise
+ *
+ */
+ task(name: string, deps?: string[], fn?: Orchestrator.TaskFunc): Gulp;
+
/**
* Takes a number of task names or functions and returns a function of the composed tasks or functions
* When the returned function is executed, the tasks or functions will be executed in series,
diff --git a/types/orchestrator/index.d.ts b/types/orchestrator/index.d.ts
index 7f8a6ed80e..52ceacf429 100644
--- a/types/orchestrator/index.d.ts
+++ b/types/orchestrator/index.d.ts
@@ -11,7 +11,7 @@ import * as Q from "q";
type _Sequencify = (tasks: Array<{ dep: string[]; }>, names: string[]) => { sequence: string[]; missingTasks: string[]; recursiveDependencies: string[]; };
-type _runTask = (task: Orchestrator.TaskMethod, done: (err: any, meta: Orchestrator.Meta) => void) => void;
+type _runTask = (task: Orchestrator.TaskFunc, done: (err: any, meta: Orchestrator.Meta) => void) => void;
type Strings = string|string[];
@@ -25,6 +25,13 @@ declare class Orchestrator extends events.EventEmitter {
reset(): Orchestrator;
+ /** Define a task
+ * @param name The name of the task.
+ * @param fn The function that performs the task's operations. For asynchronous tasks, you need to provide a hint when the task is complete:
+ * - Take in a callback
+ * - Return a stream or a promise
+ */
+ add(name: string, fn?: Orchestrator.TaskFunc): Orchestrator;
/** Define a task
* @param name The name of the task.
* @param deps An array of task names to be executed and completed before your task will run.
@@ -32,12 +39,11 @@ declare class Orchestrator extends events.EventEmitter {
* - Take in a callback
* - Return a stream or a promise
*/
- add: Orchestrator.AddMethod;
+ add(name: string, deps?: string[], fn?: Orchestrator.TaskFunc): Orchestrator;
task(name: string): Orchestrator.Task;
- task(name: string, fn: Orchestrator.TaskMethod): void;
- task(name: string, dep: string[], fn: Orchestrator.TaskMethod): void;
- task(name: string, dep?: string[] | Orchestrator.TaskMethod, fn?: Orchestrator.TaskMethod): void;
+ task(name: string, fn: Orchestrator.TaskFunc): void;
+ task(name: string, dep: string[], fn: Orchestrator.TaskFunc): void;
/** Have you defined a task with this name?
* @param name The task name to query
@@ -96,7 +102,7 @@ declare namespace Orchestrator {
/** A task, can either call a callback to indicate task completion or return a promise or a stream: (task is marked complete when promise.then() resolves/fails or stream ends)
*/
- type TaskMethod = (callback: (err?: any) => void) => Q.Promise | stream.Stream | any;
+ type TaskFunc = (callback: (err?: any) => void) => Q.Promise | stream.Stream | any;
interface AddMethod {
/** Define a task
@@ -105,7 +111,7 @@ declare namespace Orchestrator {
* - Take in a callback
* - Return a stream or a promise
*/
- (name: string, fn?: TaskMethod): Orchestrator;
+ (name: string, fn?: TaskFunc): Orchestrator;
/** Define a task
* @param name The name of the task.
* @param deps An array of task names to be executed and completed before your task will run.
@@ -113,7 +119,7 @@ declare namespace Orchestrator {
* - Take in a callback
* - Return a stream or a promise
*/
- (name: string, deps?: string[], fn?: TaskMethod): Orchestrator;
+ (name: string, deps?: string[], fn?: TaskFunc): Orchestrator;
}
/** Start running the tasks
@@ -149,7 +155,7 @@ declare namespace Orchestrator {
}
interface Task {
- fn: TaskMethod;
+ fn: TaskFunc;
dep: string[];
name: string;
done?: boolean;
diff --git a/types/orchestrator/orchestrator-tests.ts b/types/orchestrator/orchestrator-tests.ts
index e25f12fb48..13e9bb19e0 100644
--- a/types/orchestrator/orchestrator-tests.ts
+++ b/types/orchestrator/orchestrator-tests.ts
@@ -43,6 +43,20 @@ orchestrator.add('thing4', function(){
return stm;
});
+//
+// orchestrator.task(name[, deps][, function]);
+//
+
+orchestrator.task('task1');
+
+orchestrator.task('task2', function(cb) {
+ cb(null);
+});
+
+orchestrator.task('task3', ['task1', 'task2'], function() {
+ // do stuff
+});
+
//
// orchestrator.hasTask(name);
//