fix(yargs-interactive): Extend Interactive interface with yargs.Argv interface (#45831)

This commit is contained in:
Mariano Vazquez 2020-07-12 05:02:06 -03:00 committed by GitHub
parent a7e3800d07
commit d3facd7b56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -4,6 +4,8 @@
// Nano Vazquez <https://github.com/nanovazquez>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Argv } from 'yargs';
declare function yargsInteractive(): yargsInteractive.Interactive;
declare namespace yargsInteractive {
@ -17,7 +19,7 @@ declare namespace yargsInteractive {
interface Option {
[key: string]: OptionData | { default: boolean };
}
interface Interactive {
interface Interactive extends Argv {
usage(usage: string): Interactive;
interactive(options: Option): Interactive;
then(callback: (result: any) => any): Interactive;

View File

@ -23,4 +23,7 @@ yargsInteractive()
.interactive(options)
.then((result: any) => {
console.log(result);
});
})
.demandCommand(1, 1, 'You need to specify a command before moving on')
.help()
.wrap(null).version;