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

select returns undefined #12

Closed
jb-360vier opened this issue Feb 13, 2023 · 1 comment · Fixed by #13
Closed

select returns undefined #12

jb-360vier opened this issue Feb 13, 2023 · 1 comment · Fixed by #13

Comments

@jb-360vier
Copy link

jb-360vier commented Feb 13, 2023

The select prompt currently returns undefined instead of the selected options value.

const projectType = await select({
  message: "TypeScript or JavaScript?",
  options: [
    { value: "ts", label: "TypeScript", hint: "recommended" },
    { value: "js", label: "JavaScript" },
  ],
});

console.log(projectType) // undefined
@fz6m
Copy link
Contributor

fz6m commented Feb 13, 2023

+1 。

  const value2 = await select({
    message: 'What is your favorite color?',
    options: [
      {
        label: 'Red',
        value: 'red',
        hint: 'This is a hint for red',
      },
      {
        label: 'Green',
        value: 'green',
      },
    ],
    initialValue: 'green'
  })
  console.log('value2: ', value2);
  // value2 === undefined

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