diff --git a/types/vorpal/index.d.ts b/types/vorpal/index.d.ts index ee2bf2ac42..3c8c64db1a 100644 --- a/types/vorpal/index.d.ts +++ b/types/vorpal/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for vorpal 1.11 +// Type definitions for vorpal 1.12 // Project: https://github.com/dthree/vorpal // Definitions by: Daniel Byrne +// Gheorghe Avram // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 3.5 declare class Vorpal { parse(argv: ReadonlyArray): this; @@ -34,6 +35,10 @@ declare namespace Vorpal { }; } + interface PromptObject { + [key: string]: any; + } + type Action = (args: Args) => Promise; type Cancel = () => void; @@ -74,7 +79,7 @@ declare namespace Vorpal { class CommandInstance { log(value: string, ...values: string[]): void; - prompt(prompt: object | ReadonlyArray): Promise; + prompt(prompt: object | ReadonlyArray): Promise; delimiter(value: string): void; } } diff --git a/types/vorpal/vorpal-tests.ts b/types/vorpal/vorpal-tests.ts index 4499365fd0..150fd4dd2c 100644 --- a/types/vorpal/vorpal-tests.ts +++ b/types/vorpal/vorpal-tests.ts @@ -10,6 +10,18 @@ vorpal vorpal.log('bar'); return Promise.resolve(); }); +vorpal + .command('input', 'Test Prompt Function') + .action(async (action) => { + const promptInput = await vorpal.activeCommand.prompt([ + { + type: 'input', + name: 'exampleInput', + message: 'Please Input Something', + } + ]); + vorpal.log(promptInput.exampleInput); + }); vorpal .delimiter('myapp$')