Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#144 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
node.js, typescript
領域
cli

調査の方向性

SelectPrompt エントリーポイントと select API から始め、次に空の options 配列を使ってリンクされた StackBlitz の再現コードを実行します。初期オプションの値がどこで読み取られているかを追跡し、パッケージに既存のバリデーションパターンを確認します。両方の API が、報告された TypeError を発生させずに空の配列を拒否するか、明確に処理できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug

Environment

Describe the bug
SelectPrompt throws a TypeError when given an empty options array.
Encountered when using @sentry/[email protected], see the related issue: https://github.com/getsentry/sentry-wizard/issues/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)

主要言語
TypeScript
スター
8.1k
フォーク
218
平均マージ
1日 23時間
マージ済み PR(30日)
6

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bombshell-dev/clack のほかの issue

bombshell-dev/clack の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。