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

[Bug] SelectPrompt throws a TypeError when given an empty options array #144

Open
kevduc opened this issue Aug 17, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@kevduc
Copy link

kevduc commented Aug 17, 2023

Environment

  • OS: Windows
  • Node Version: v16.16.0
  • Package: @clack/core (depended on by @sentry/wizard@3.9.2)
  • Package Version: v0.3.2

Describe the bug
SelectPrompt throws a TypeError when given an empty options array.
Encountered when using @sentry/wizard@3.9.2, see the related issue: getsentry/sentry-wizard#400

Example:

TypeError: Cannot read properties of undefined (reading 'value')
    at SelectPrompt.changeValue (C:\Users\xyz\AppData\Local\npm-cache\_npx\ddb126e78325956c\node_modules\@clack\core\dist\index.cjs:14:3567)
    at new SelectPrompt (C:\Users\xyz\AppData\Local\npm-cache\_npx\ddb126e78325956c\node_modules\@clack\core\dist\index.cjs:14:3235)

To Reproduce
https://stackblitz.com/edit/node-kyd3oq?file=index.ts

Pass an empty array for options when creating a new SelectPrompt

Expected behavior
SelectPrompt (and select from @clack/prompts) should require at least 1 element in the array (it doesn't make sense to have no options to select from)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant