diff --git a/types/yargs-interactive/index.d.ts b/types/yargs-interactive/index.d.ts index 0f0d3461de..c28b6eb9cd 100644 --- a/types/yargs-interactive/index.d.ts +++ b/types/yargs-interactive/index.d.ts @@ -1,17 +1,18 @@ -// Type definitions for yargs-interactive 2.0 +// Type definitions for yargs-interactive 2.1 // Project: https://github.com/nanovazquez/yargs-interactive#readme // Definitions by: Steven Zeck +// Nano Vazquez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare function yargsInteractive(): yargsInteractive.Interactive; declare namespace yargsInteractive { interface OptionData { - type: string; + type: 'input' | 'number' | 'confirm' | 'list' | 'rawlist' | 'expand' | 'checkbox' | 'password' | 'editor'; describe: string; - default?: string | number | boolean; - prompt?: string; - options?: string[]; + default?: string | number | boolean | any[]; + prompt?: 'always' | 'never' | 'if-no-arg' | 'if-empty'; + choices?: string[]; } interface Option { [key: string]: OptionData | { default: boolean }; diff --git a/types/yargs-interactive/yargs-interactive-tests.ts b/types/yargs-interactive/yargs-interactive-tests.ts index cff1ca16c2..b15a0bba62 100644 --- a/types/yargs-interactive/yargs-interactive-tests.ts +++ b/types/yargs-interactive/yargs-interactive-tests.ts @@ -1,19 +1,26 @@ /// -import yargsInteractive = require("yargs-interactive"); +import yargsInteractive = require('yargs-interactive'); const options: yargsInteractive.Option = { - color: { - describe: "What is your favorite color?", - prompt: "always", - type: "input", - default: "Blue", - } + name: { + describe: 'What is your name?', + prompt: 'always', + type: 'input', + default: 'Nano', + }, + color: { + describe: 'What is your favorite color?', + prompt: 'always', + type: 'list', + choices: ['Blue', 'Red', 'Yellow'], + default: 'Blue', + }, }; yargsInteractive() - .usage("$0 [args]") - .interactive(options) - .then((result: any) => { - console.log(result); - }); + .usage('$0 [args]') + .interactive(options) + .then((result: any) => { + console.log(result); + });