@types/prompts

  • Version 2.0.12
  • Published
  • 7.55 kB
  • 1 dependency
  • MIT license

Install

npm i @types/prompts
yarn add @types/prompts
pnpm add @types/prompts

Overview

TypeScript definitions for prompts

Index

Variables

variable prompt

const prompt: any;

    Functions

    function inject

    inject: typeof inject;

      function override

      override: typeof override;

        function prompts

        prompts: typeof prompts;

          Interfaces

          interface Choice

          interface Choice {}

            property description

            description?: string;

              property disabled

              disabled?: boolean;

                property selected

                selected?: boolean;

                  property title

                  title: string;

                    property value

                    value?: any;

                      interface Options

                      interface Options {}

                        property onCancel

                        onCancel?: (prompt: PromptObject, answers: any) => void;

                          property onSubmit

                          onSubmit?: (prompt: PromptObject, answer: any, answers: any[]) => void;

                            interface PromptObject

                            interface PromptObject<T extends string = string> {}

                              property active

                              active?: string | PrevCaller<T, string | Falsy>;

                                property choices

                                choices?: Choice[] | PrevCaller<T, Choice[] | Falsy>;

                                  property float

                                  float?: boolean | PrevCaller<T, boolean | Falsy>;

                                    property format

                                    format?: PrevCaller<T, void>;

                                      property hint

                                      hint?: string | PrevCaller<T, string | Falsy>;

                                        property inactive

                                        inactive?: string | PrevCaller<T, string | Falsy>;

                                          property increment

                                          increment?: number | PrevCaller<T, number | Falsy>;

                                            property initial

                                            initial?: string | number | boolean | Date;

                                              property instructions

                                              instructions?: string | boolean;

                                                property limit

                                                limit?: number | PrevCaller<T, number | Falsy>;

                                                  property mask

                                                  mask?: string | PrevCaller<T, string | Falsy>;

                                                    property max

                                                    max?: number | PrevCaller<T, number | Falsy>;

                                                      property message

                                                      message?: ValueOrFunc<string>;

                                                        property min

                                                        min?: number | PrevCaller<T, number | Falsy>;

                                                          property name

                                                          name: ValueOrFunc<T>;

                                                            property onState

                                                            onState?: PrevCaller<T, void>;

                                                              property round

                                                              round?: number | PrevCaller<T, number | Falsy>;

                                                                property separator

                                                                separator?: string | PrevCaller<T, string | Falsy>;

                                                                  property stdin

                                                                  stdin?: Readable;

                                                                    property stdout

                                                                    stdout?: Writable;

                                                                      property style

                                                                      style?: string | PrevCaller<T, string | Falsy>;

                                                                        property suggest

                                                                        suggest?: (input: any, choices: Choice[]) => Promise<any>;

                                                                          property type

                                                                          type: PromptType | Falsy | PrevCaller<T, PromptType | Falsy>;

                                                                            property validate

                                                                            validate?: PrevCaller<T, boolean | string | Promise<boolean | string>>;

                                                                              property warn

                                                                              warn?: string | PrevCaller<T, string | Falsy>;

                                                                                Type Aliases

                                                                                type Answers

                                                                                type Answers<T extends string> = { [id in T]: any };

                                                                                  type Falsy

                                                                                  type Falsy = false | null | undefined;

                                                                                    type PrevCaller

                                                                                    type PrevCaller<T extends string, R = T> = (
                                                                                    prev: any,
                                                                                    values: Answers<T>,
                                                                                    prompt: PromptObject
                                                                                    ) => R;

                                                                                      type PromptType

                                                                                      type PromptType =
                                                                                      | 'text'
                                                                                      | 'password'
                                                                                      | 'invisible'
                                                                                      | 'number'
                                                                                      | 'confirm'
                                                                                      | 'list'
                                                                                      | 'toggle'
                                                                                      | 'select'
                                                                                      | 'multiselect'
                                                                                      | 'autocomplete'
                                                                                      | 'date'
                                                                                      | 'autocompleteMultiselect';

                                                                                        type ValueOrFunc

                                                                                        type ValueOrFunc<T extends string> = T | PrevCaller<T>;

                                                                                          Namespaces

                                                                                          namespace inject

                                                                                          namespace inject {}

                                                                                            variable prototype

                                                                                            const prototype: {};

                                                                                              namespace override

                                                                                              namespace override {}

                                                                                                variable prototype

                                                                                                const prototype: {};

                                                                                                  namespace prompts

                                                                                                  namespace prompts {}

                                                                                                    function autocomplete

                                                                                                    autocomplete: (args: PromptObject) => any;

                                                                                                      function confirm

                                                                                                      confirm: (args: PromptObject) => void;

                                                                                                        function date

                                                                                                        date: (args: PromptObject) => any;

                                                                                                          function invisible

                                                                                                          invisible: (args: PromptObject) => any;

                                                                                                            function list

                                                                                                            list: (args: PromptObject) => any;

                                                                                                              function multiselect

                                                                                                              multiselect: (args: PromptObject) => any;

                                                                                                                function number

                                                                                                                number: (args: PromptObject) => void;

                                                                                                                  function password

                                                                                                                  password: (args: PromptObject) => any;

                                                                                                                    function select

                                                                                                                    select: (args: PromptObject) => void;

                                                                                                                      function text

                                                                                                                      text: (args: PromptObject) => void;

                                                                                                                        function toggle

                                                                                                                        toggle: (args: PromptObject) => void;

                                                                                                                          Package Files (1)

                                                                                                                          Dependencies (1)

                                                                                                                          Dev Dependencies (0)

                                                                                                                          No dev dependencies.

                                                                                                                          Peer Dependencies (0)

                                                                                                                          No peer dependencies.

                                                                                                                          Badge

                                                                                                                          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/prompts.

                                                                                                                          • Markdown
                                                                                                                            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/prompts)
                                                                                                                          • HTML
                                                                                                                            <a href="https://www.jsdocs.io/package/@types/prompts"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>