mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Vendored
+76
@@ -0,0 +1,76 @@
|
||||
// Type definitions for prompts 1.1
|
||||
// Project: https://github.com/terkelg/prompts
|
||||
// Definitions by: Berkay GURSOY <https://github.com/Berkays>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
export = prompts;
|
||||
|
||||
declare function prompts(questions: prompts.PromptObject | prompts.PromptObject[], options?: prompts.Options): any;
|
||||
|
||||
declare namespace prompts {
|
||||
// Circular reference from prompts
|
||||
const prompt: any;
|
||||
|
||||
function inject(obj: any): void;
|
||||
|
||||
namespace inject {
|
||||
const prototype: {
|
||||
};
|
||||
}
|
||||
|
||||
namespace prompts {
|
||||
function autocomplete(args: PromptObject): any;
|
||||
|
||||
function confirm(args: PromptObject): void;
|
||||
|
||||
function invisible(args: PromptObject): any;
|
||||
|
||||
function list(args: PromptObject): any;
|
||||
|
||||
function multiselect(args: PromptObject): any;
|
||||
|
||||
function number(args: PromptObject): void;
|
||||
|
||||
function password(args: PromptObject): any;
|
||||
|
||||
function select(args: PromptObject): void;
|
||||
|
||||
function text(args: PromptObject): void;
|
||||
|
||||
function toggle(args: PromptObject): void;
|
||||
}
|
||||
|
||||
interface Choice {
|
||||
title: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
onSubmit: (prompt: PromptObject, answer: any, answers: any[]) => void;
|
||||
onCancel: (prompt: PromptObject, answers: any) => void;
|
||||
}
|
||||
|
||||
interface PromptObject {
|
||||
type: string | ((prev: any, values: any, prompt: PromptObject) => void);
|
||||
name: string | ((prev: any, values: any, prompt: PromptObject) => void);
|
||||
message?: string | ((prev: any, values: any, prompt: PromptObject) => void);
|
||||
initial?: string;
|
||||
style?: string;
|
||||
format?: ((prev: any, values: any, prompt: PromptObject) => void);
|
||||
validate?: ((prev: any, values: any, prompt: PromptObject) => void);
|
||||
onState?: ((prev: any, values: any, prompt: PromptObject) => void);
|
||||
min?: number;
|
||||
max?: number;
|
||||
float?: boolean;
|
||||
round?: number;
|
||||
increment?: number;
|
||||
seperator?: string;
|
||||
active?: string;
|
||||
inactive?: string;
|
||||
choices?: Choice[];
|
||||
hint?: string;
|
||||
suggest?: ((prev: any, values: any, prompt: PromptObject) => void);
|
||||
limit?: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import prompts = require("prompts");
|
||||
|
||||
const response = prompts({
|
||||
type: 'number',
|
||||
name: 'value',
|
||||
message: 'Input value to double:',
|
||||
validate: (value: any) => value < 0 ? `Cant be less than zero` : true
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"prompts-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user