@types/prompts

  • Version 2.4.9
  • Published
  • 7.96 kB
  • 2 dependencies
  • 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 | undefined;

              property disabled

              disabled?: boolean | undefined;

                property selected

                selected?: boolean | undefined;

                  property title

                  title: string;

                    property value

                    value?: any;

                      interface Options

                      interface Options {}

                        property onCancel

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

                          property onSubmit

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

                            interface PromptObject

                            interface PromptObject<T extends string = string> {}

                              property active

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

                                property choices

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

                                  property float

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

                                    property format

                                    format?: PrevCaller<T, void> | undefined;

                                      property hint

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

                                        property inactive

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

                                          property increment

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

                                            property initial

                                            initial?:
                                            | InitialReturnValue
                                            | PrevCaller<T, InitialReturnValue | Promise<InitialReturnValue>>
                                            | undefined;

                                              property instructions

                                              instructions?: string | boolean | undefined;

                                                property limit

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

                                                  property mask

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

                                                    property max

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

                                                      property message

                                                      message?: ValueOrFunc<string> | undefined;

                                                        property min

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

                                                          property name

                                                          name: ValueOrFunc<T>;

                                                            property onRender

                                                            onRender?: ((kleur: Kleur) => void) | undefined;

                                                              property onState

                                                              onState?: PrevCaller<T, void> | undefined;

                                                                property round

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

                                                                  property separator

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

                                                                    property stdin

                                                                    stdin?: Readable | undefined;

                                                                      property stdout

                                                                      stdout?: Writable | undefined;

                                                                        property style

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

                                                                          property suggest

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

                                                                            property type

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

                                                                              property validate

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

                                                                                property warn

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

                                                                                  Type Aliases

                                                                                  type Answers

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

                                                                                    type Falsy

                                                                                    type Falsy = false | null | undefined;

                                                                                      type InitialReturnValue

                                                                                      type InitialReturnValue = string | number | boolean | Date;

                                                                                        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 (2)

                                                                                                                              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>