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

Make OptionValueSource a string with well-known values for auto-complete #1983

Merged

Conversation

shadowspawn
Copy link
Collaborator

Pull Request

Problem

Authors are allowed to use their own strings for OptionValueSource, but the usual range will just be the values that Commander uses. The TypeScript typing only listed the Commander values to support the primary use, and get autocomplete in the editor.

Solution

Use a well-known "trick" to specify a string with some known values. The known values are offered for auto-complete by VSCode, and TypeScript allows other values too.

This was prototyped in https://github.com/commander-js/extra-typings

References:

ChangeLog

  • fix: update OptionValueSource to allow any string to match supported custom use

Copy link
Collaborator

@abetomo abetomo left a comment

Choose a reason for hiding this comment

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

LGTM

@shadowspawn shadowspawn merged commit 0d432ba into tj:develop Aug 26, 2023
11 checks passed
@shadowspawn shadowspawn added the pending release Merged into a branch for a future release, but not released yet label Aug 26, 2023
@shadowspawn shadowspawn deleted the feature/improve-option-value-source-type branch August 26, 2023 08:33
@shadowspawn shadowspawn removed the pending release Merged into a branch for a future release, but not released yet label Feb 3, 2024
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.

None yet

2 participants