diff --git a/types/prompts/index.d.ts b/types/prompts/index.d.ts index bfb08a8bd7..0db58ea435 100644 --- a/types/prompts/index.d.ts +++ b/types/prompts/index.d.ts @@ -52,12 +52,12 @@ declare namespace prompts { } interface Options { - onSubmit: (prompt: PromptObject, answer: any, answers: any[]) => void; - onCancel: (prompt: PromptObject, answers: any) => void; + onSubmit?: (prompt: PromptObject, answer: any, answers: any[]) => void; + onCancel?: (prompt: PromptObject, answers: any) => void; } interface PromptObject { - type: ValueOrFunc | Falsy; + type: ValueOrFunc | Falsy; name: ValueOrFunc; message?: ValueOrFunc; initial?: string | number | boolean; @@ -89,5 +89,7 @@ declare namespace prompts { type Falsy = false | null | undefined; + type PromptType = "text" | "password" | "invisible" | "number" | "confirm" | "list" | "toggle" | "select" | "multiselect" | "autocomplete" | Falsy + type ValueOrFunc = T | PrevCaller; }