@types/inquirer
Advanced tools
Comparing version 0.0.36 to 0.0.37
@@ -6,7 +6,9 @@ // Type definitions for Inquirer.js | ||
// Jouderian <https://github.com/jouderianjr> | ||
// Qibang <https://github.com/bang88> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.3 | ||
/// <reference types="rx" /> | ||
import through = require('through'); | ||
import through = require("through"); | ||
@@ -16,3 +18,6 @@ declare namespace inquirer { | ||
type ChoiceType = string | objects.ChoiceOption | objects.Separator; | ||
type Questions = Question | Question[] | Rx.Observable<Question>; | ||
type Questions<T> = | ||
| Question<T> | ||
| Question<T>[] | ||
| Rx.Observable<Question<T>>; | ||
@@ -37,4 +42,4 @@ interface Inquirer { | ||
*/ | ||
prompt(questions: Questions, cb: (answers: Answers) => any): ui.Prompt; | ||
prompt(questions: Questions): Promise<Answers>; | ||
prompt<T>(questions: Questions<T>, cb: (answers: T) => any): ui.Prompt; | ||
prompt<T>(questions: Questions<T>): Promise<T>; | ||
prompts: Prompts; | ||
@@ -45,8 +50,8 @@ Separator: objects.SeparatorStatic; | ||
Prompt: ui.Prompt; | ||
} | ||
}; | ||
} | ||
interface PromptModule { | ||
(questions: Questions): Promise<Answers>; | ||
(questions: Questions, cb: (answers: Answers) => any): ui.Prompt; | ||
<T>(questions: Questions<T>): Promise<T>; | ||
<T>(questions: Questions<T>, cb: (answers: T) => any): ui.Prompt; | ||
/** | ||
@@ -64,3 +69,3 @@ * Register a prompt type | ||
interface Question { | ||
interface Question<T = Answers> { | ||
/** | ||
@@ -87,3 +92,3 @@ * Type of the prompt. | ||
*/ | ||
message?: string | ((answers: Answers) => string); | ||
message?: string | ((answers: T) => string); | ||
/** | ||
@@ -93,3 +98,3 @@ * Default value(s) to use if nothing is entered, or a function that returns the default value(s). | ||
*/ | ||
default?: any | ((answers: Answers) => any); | ||
default?: any | ((answers: T) => any); | ||
/** | ||
@@ -101,3 +106,3 @@ * Choices array or a function returning a choices array. If defined as a function, | ||
*/ | ||
choices?: ChoiceType[] | ((answers: Answers) => ChoiceType[]); | ||
choices?: ChoiceType[] | ((answers: T) => ChoiceType[]); | ||
/** | ||
@@ -107,3 +112,3 @@ * Receive the user input and should return true if the value is valid, and an error message (String) | ||
*/ | ||
validate?(input: string, answers?: Answers): boolean | string; | ||
validate?(input: string, answers?: T): boolean | string; | ||
/** | ||
@@ -118,3 +123,3 @@ * Receive the user input and return the filtered value to be used inside the program. | ||
*/ | ||
when?: boolean | ((answers: Answers) => boolean); | ||
when?: boolean | ((answers: T) => boolean); | ||
paginated?: boolean; | ||
@@ -156,6 +161,6 @@ /** | ||
onCompletion(): void; | ||
processQuestion(question: Question): any; | ||
fetchAnswer(question: Question): any; | ||
setDefaultType(question: Question): any; | ||
filterIfRunnable(question: Question): any; | ||
processQuestion<T>(question: Question<T>): any; | ||
fetchAnswer<T>(question: Question<T>): any; | ||
setDefaultType<T>(question: Question<T>): any; | ||
filterIfRunnable<T>(question: Question<T>): any; | ||
} | ||
@@ -251,3 +256,3 @@ | ||
checked?: boolean; | ||
disabled?: string | ((answers: Answers) => any); | ||
disabled?: string | (<T = Answers>(answers: T) => any); | ||
} | ||
@@ -262,3 +267,6 @@ | ||
interface Choices { | ||
new (choices: (string | Separator | ChoiceOption)[], answers?: Answers): Choices; | ||
new <T = Answers>( | ||
choices: (string | Separator | ChoiceOption)[], | ||
answers?: T | ||
): Choices; | ||
choices: Choice[]; | ||
@@ -265,0 +273,0 @@ realChoices: Choice[]; |
{ | ||
"name": "@types/inquirer", | ||
"version": "0.0.36", | ||
"version": "0.0.37", | ||
"description": "TypeScript definitions for Inquirer.js", | ||
@@ -21,2 +21,7 @@ "license": "MIT", | ||
"githubUsername": "jouderianjr" | ||
}, | ||
{ | ||
"name": "Qibang", | ||
"url": "https://github.com/bang88", | ||
"githubUsername": "bang88" | ||
} | ||
@@ -34,4 +39,4 @@ ], | ||
}, | ||
"typesPublisherContentHash": "2082596eb9d3f59f865c772e6c862bb23e8c98db581dac6ba483107e5fc747f8", | ||
"typesPublisherContentHash": "bd27cb95e14ae3f32554d26ddda9ffb2eb5e2258394f53a21936983d71774049", | ||
"typeScriptVersion": "2.0" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Wed, 13 Dec 2017 23:23:23 GMT | ||
* Last updated: Thu, 08 Mar 2018 23:25:55 GMT | ||
* Dependencies: through, rx | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by Qubo <https://github.com/tkQubo>, Parvez <https://github.com/ppathan>, Jouderian <https://github.com/jouderianjr>. | ||
These definitions were written by Qubo <https://github.com/tkQubo>, Parvez <https://github.com/ppathan>, Jouderian <https://github.com/jouderianjr>, Qibang <https://github.com/bang88>. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13976
305