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

prompt list returns undefined #1482

Closed
rafipiccolo opened this issue Jul 25, 2024 · 3 comments
Closed

prompt list returns undefined #1482

rafipiccolo opened this issue Jul 25, 2024 · 3 comments

Comments

@rafipiccolo
Copy link

rafipiccolo commented Jul 25, 2024

import inquirer from 'inquirer';

const allfiles = [
    {name: 'a', content: 'a'},
    {name: 'b', content: 'b'},
    {name: 'c', content: 'c'},
];
const answers = await inquirer.prompt([
    {
        type: 'list',
        name: 'answer',
        message: 'merge files ? (select source)',
        choices: allfiles,
    },
]);

console.log(answers);
// { answer: undefined }
@rafipiccolo
Copy link
Author

worked with 9.3.5 but not since 10.0.0
is there a new way ? i didnt see anything in release comments

@SBoudrias
Copy link
Owner

The issue is the choice list doesn't provide a value attribute.

I'll document it, I wasn't aware of that previous behavior. (And I think I'll add a validation step so it's the easy to spot)

@rafipiccolo
Copy link
Author

thx for your clarification, feel free to close as i have quit using the object form.

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

No branches or pull requests

2 participants