mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-29 08:58:23 +08:00
Add max argument overload to yargs.demand (#12336)
* Add max argument overload to yargs.demand * Add yargs.demand variant with max but without msg * yargs: Add some tests for .demand overloads * yargs: Use ? instead of separate overload definition * Merge tests fix from 640b1b735555ee4766e4f4428f54c98fd01427c8
This commit is contained in:
committed by
Masahiro Wakame
parent
f843767243
commit
674de3e822
1
yargs/index.d.ts
vendored
1
yargs/index.d.ts
vendored
@@ -40,6 +40,7 @@ declare namespace yargs {
|
||||
demand(keys: string[], required?: boolean): Argv;
|
||||
demand(positionals: number, required?: boolean): Argv;
|
||||
demand(positionals: number, msg: string): Argv;
|
||||
demand(positionals: number, max: number, msg?: string): Argv;
|
||||
|
||||
require(key: string, msg: string): Argv;
|
||||
require(key: string, required: boolean): Argv;
|
||||
|
||||
@@ -57,6 +57,9 @@ function divide() {
|
||||
function demand_count() {
|
||||
var argv = yargs
|
||||
.demand(2)
|
||||
.demand(2, false)
|
||||
.demand(2, 2)
|
||||
.demand(2, 2, "message")
|
||||
.argv;
|
||||
console.dir(argv);
|
||||
}
|
||||
@@ -224,7 +227,7 @@ function completion_sync() {
|
||||
|
||||
function completion_async() {
|
||||
var argv = yargs
|
||||
.completion('completion', (current, argv, done) => {
|
||||
.completion('completion', (current: string, argv: any, done: (completion: string[]) => void) => {
|
||||
setTimeout(function () {
|
||||
done([
|
||||
'apple',
|
||||
|
||||
Reference in New Issue
Block a user