-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Currently, the return type of the methods in class Command is Command:
public command(name: string, desc?: string, opts?: commander.CommandOptions): Command;I cannot extend Command to add more methods, like this:
class MyCommandWithUtilities extends Command {
public util1(): this {
// ...
return this;
}
}
const cmd = new MyCommandWithUtilities();
cmd
.command('foo')
.util1() // Syntax error, because `command` returns `Command`, not `MyCommandWithUtilities`
.option(...);So, please change the return type of the methods in Command to this.
public command(name: string, desc?: string, opts?: commander.CommandOptions): this;It seems that simply changing the definitions in index.d.ts is not enough. The main source code must also be changed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels