Skip to content

Conversation

Sakthieswaran-tech
Copy link

@Sakthieswaran-tech Sakthieswaran-tech commented Sep 24, 2025

This PR updates the checkbox prompt to display the checkedName property for selected options,
falling back to name if checkedName is not provided. It includes:

  • Updated normalizeChoices to handle checkedName.
  • Updated renderItem logic to display checkedName when an item is checked.
  • Test case added to verify the behavior.

This improves the clarity of selected options in prompts without breaking existing functionality.

Resolves #1647

@Sakthieswaran-tech Sakthieswaran-tech force-pushed the feature/checkbox-checked-name branch from 1713e40 to 02928ea Compare September 28, 2025 05:42
Copy link

codecov bot commented Sep 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@f4579f4). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1844   +/-   ##
=======================================
  Coverage        ?   95.74%           
=======================================
  Files           ?       45           
  Lines           ?     2772           
  Branches        ?      750           
=======================================
  Hits            ?     2654           
  Misses          ?      109           
  Partials        ?        9           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Sakthieswaran-tech
Copy link
Author

Hey @SBoudrias
I noticed that after adding checkedName internally in Choice, all local tests pass, but the e2e demo fails with this TypeScript error:
Object literal may only specify known properties, and 'checkedName' does not exist in type 'Separator | Choice'
I think the issue is related to the types exposed publicly in the checkbox package. I’m not 100% sure what the preferred approach is here — should checkedName be added to the public Choice type in CheckboxConfig, or exported separately, or handled some other way?

@Sakthieswaran-tech
Copy link
Author

Hey @SBoudrias ,

I’m still running into a TypeScript issue with the checkedName property. After adding it internally in Choice, all local tests pass, but the e2e demo fails with:

Object literal may only specify known properties, and 'checkedName' does not exist in type 'Separator | Choice'

I’ve checked the types exposed publicly in the checkbox package and I’m unsure what the preferred approach is. Should checkedName be added to the public Choice type in CheckboxConfig, exported separately, or handled another way?

I’d appreciate your guidance so I can finalize the PR. Thanks!

@SBoudrias
Copy link
Owner

I believe it's an issue with the e2e test itself - we never added a new type this way, so the test didn't run into this case where it needs to whole package re-generated.

@Sakthieswaran-tech
Copy link
Author

Hey @SBoudrias , thanks a lot for looking into this and fixing the e2e issue — really appreciate it!
Let me know if there’s anything you’d like me to update or re-run on my side to help get this merged.

Comment on lines 159 to 168
yarn set resolution @inquirer/prompts/@inquirer/checkbox@npm:* file:/tmp/artifacts/inquirer-checkbox.tgz
yarn set resolution @inquirer/prompts/@inquirer/confirm@npm:* file:/tmp/artifacts/inquirer-confirm.tgz
yarn set resolution @inquirer/prompts/@inquirer/editor@npm:* file:/tmp/artifacts/inquirer-editor.tgz
yarn set resolution @inquirer/prompts/@inquirer/expand@npm:* file:/tmp/artifacts/inquirer-expand.tgz
yarn set resolution @inquirer/prompts/@inquirer/input@npm:* file:/tmp/artifacts/inquirer-input.tgz
yarn set resolution @inquirer/prompts/@inquirer/number@npm:* file:/tmp/artifacts/inquirer-number.tgz
yarn set resolution @inquirer/prompts/@inquirer/password@npm:* file:/tmp/artifacts/inquirer-password.tgz
yarn set resolution @inquirer/prompts/@inquirer/rawlist@npm:* file:/tmp/artifacts/inquirer-rawlist.tgz
yarn set resolution @inquirer/prompts/@inquirer/search@npm:* file:/tmp/artifacts/inquirer-search.tgz
yarn set resolution @inquirer/prompts/@inquirer/select@npm:* file:/tmp/artifacts/inquirer-select.tgz
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what's breaking the e2e test.

Resources:

yarn set resolution <descriptor> <resolution>

The <descriptor> isn't correct to link the prompt packages required by @inquirer/prompts to use the one from the repo.

I'm short on time to figure the exact syntax, but that's the problem. Hopefully it gives you enough to research a bit the issue 🤞🏻

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 this pull request may close these issues.

Feat: @inquirer/prompts checkbox support for different name when selected
2 participants