Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion typings/commander-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ function increaseVerbosity(v: any, total: number) {
return total + 1;
}

function syncCall() {
console.log("Sync success!");
}

async function asyncCall() {
return;
}

program
.version('0.0.1')
.usage('[options] <file ...>')
Expand Down Expand Up @@ -111,7 +119,11 @@ program

program
.command("name1", "description")
.command("name2", "description", { isDefault:true })
.command("name2", "description", { isDefault:true });

program
.command("name3").action(syncCall)
.command("name4").action(asyncCall);

program
.exitOverride();
Expand Down
2 changes: 1 addition & 1 deletion typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ declare namespace commander {
*
* @returns Command for chaining
*/
action(fn: (...args: any[]) => void): Command;
action(fn: (...args: any[]) => void | Promise<void>): Command;

/**
* Define option with `flags`, `description` and optional
Expand Down