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

Unexpected prompt/question to evaluate question type #198

Closed
vaffonso opened this issue Aug 30, 2019 · 1 comment · Fixed by #221
Closed

Unexpected prompt/question to evaluate question type #198

vaffonso opened this issue Aug 30, 2019 · 1 comment · Fixed by #221

Comments

@vaffonso
Copy link
Contributor

Describe the bug

Function signature does not return the previous prompt but the current instead.
As per documentation, function signature suppose to return previous prompt object (3rd attribute)

To Reproduce

Steps to reproduce the behavior:

  1. Create question list with 2 items
  2. Type of second question type should use function to validate if name of previous prompt is the name of the 1st question.
[
    {
        type: 'select',
        name: 'anumber',
        message: 'Choose',
        choices: [
            { title: '1st', value: 1 },
            { title: '2nd', value: 2 }
        ],
        initial: 0
    },
    {
        type: (prev, values, prompt) => (prompt.name === 'anumber') ? 'number' : null,
        name: '2ndQuestion',
        message: 'second question',
    }

]

Expected behavior

Prompt should present the 2nd question based on the question type function.

System

  • OS: MacOS 10.14.6
  • Terminal: vs code terminal V1.36.0
  • Node version: v12.7.0

Additional context

Add any other context about the problem here.

vaffonso pushed a commit to vaffonso/prompts that referenced this issue Oct 26, 2019
@terkelg
Copy link
Owner

terkelg commented Nov 3, 2019

Thank you @vaffonso! Nice catch

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 a pull request may close this issue.

2 participants