Skip to content

Add missing types for prompt#286

Open
sorenlouv wants to merge 3 commits into
enquirer:masterfrom
sorenlouv:patch-3
Open

Add missing types for prompt#286
sorenlouv wants to merge 3 commits into
enquirer:masterfrom
sorenlouv:patch-3

Conversation

@sorenlouv

Copy link
Copy Markdown

This PR exports PromptOptions so it can be consumed, and adds a few properties to BasePrompt

This is much less ambitious than #261 but might be easier to merge since the scope is much smaller.

Comment thread index.d.ts
state: {
size: number;
submitted: boolean;
};

@sorenlouv sorenlouv May 22, 2020

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also be specified separately as:

  export class State {
    type: string
    name: string
    message: string
    header: string
    footer: string
    error: string
    hint: string
    input: string
    cursor: number
    index: number
    lines: number
    tick: number
    prompt: string
    buffer: string
    width: number
    symbols: any
    styles: any
    required: typeof Set
    cancelled: boolean
    submitted: boolean
    loading: boolean | 'choices'
    readonly status: 'pending' | 'cancelled' | 'submitted'
    _choices: types.Choice[]

    clone(): Omit<State, 'clone' | 'buffer'> & { buffer: Buffer }

    color: Function | any
  }

Source: https://github.com/enquirer/enquirer/pull/261/files?file-filters%5B%5D=.ts#diff-b52768974e6bc0faccb7d4b75b162c99R369

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant