diff --git a/types/inquirer/index.d.ts b/types/inquirer/index.d.ts index 4fc2ca4ce0..e2e897741d 100644 --- a/types/inquirer/index.d.ts +++ b/types/inquirer/index.d.ts @@ -5,6 +5,7 @@ // Jouderian // Qibang // Jason Dreyzehner +// Synarque // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -90,7 +91,7 @@ declare namespace inquirer { * Default value(s) to use if nothing is entered, or a function that returns the default value(s). * If defined as a function, the first parameter will be the current inquirer session answers. */ - default?: any | ((answers: T) => any); + default?: any | ((answers: T) => any) | ((answers: T) => Promise); /** * Choices array or a function returning a choices array. If defined as a function, * the first parameter will be the current inquirer session answers. @@ -99,22 +100,23 @@ declare namespace inquirer { */ choices?: | ReadonlyArray - | ((answers: T) => ReadonlyArray); + | ((answers: T) => ReadonlyArray) + | ((answers: T) => Promise>); /** * Receive the user input and should return true if the value is valid, and an error message (String) * otherwise. If false is returned, a default error message is provided. */ - validate?(input: string, answers?: T): boolean | string; + validate?(input: string, answers?: T): boolean | string | Promise; /** * Receive the user input and return the filtered value to be used inside the program. * The value returned will be added to the Answers hash. */ - filter?(input: string): string; + filter?(input: string): string | Promise; /** * Receive the current user answers hash and should return true or false depending on whether or * not this question should be asked. The value can also be a simple boolean. */ - when?: boolean | ((answers: T) => boolean); + when?: boolean | ((answers: T) => boolean) | ((answers: T) => Promise); paginated?: boolean; /** * Change the number of lines that will be rendered when using list, rawList, expand or checkbox.