Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing types for prompt #286

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

sorenlouv
Copy link

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.

state: {
size: number;
submitted: boolean;
};
Copy link
Author

@sorenlouv sorenlouv May 22, 2020

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.

None yet

1 participant