Skip to content

fix(#44) complex values#86

Merged
natemoo-re merged 2 commits into
mainfrom
fix-44_complex_values
Feb 26, 2023
Merged

fix(#44) complex values#86
natemoo-re merged 2 commits into
mainfrom
fix-44_complex_values

Conversation

@ulken

@ulken ulken commented Feb 26, 2023

Copy link
Copy Markdown
Collaborator

Select prompts (incl. multi + group-multi):

  • simplify option value types
  • support complex value types

Screenshot 2023-02-26 at 01 06 11

Fixes #44 (for realz).

Note: selectKey is not supported since it requires value to be string.

@ulken ulken self-assigned this Feb 26, 2023
@changeset-bot

changeset-bot Bot commented Feb 26, 2023

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ca08fb6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clack/prompts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ulken ulken requested a review from natemoo-re February 26, 2023 00:32
@ulken ulken marked this pull request as ready for review February 26, 2023 00:32
@ulken ulken force-pushed the fix-44_complex_values branch from 048f8b4 to c308518 Compare February 26, 2023 00:33
@ulken ulken force-pushed the fix-44_complex_values branch from 3b2139c to ca08fb6 Compare February 26, 2023 00:38
export interface SelectOptions<Options extends Option<Value>[], Value extends Primitive> {

type Option<Value> = Value extends Primitive
? { value: Value; label?: string; hint?: string }

@ulken ulken Feb 26, 2023

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Suppose we could extract aliases for these, if it would make it easier to decipher violations?

type PrimitiveOption<Value extends Primitive> = { value: Value; label?: string; hint?: string>

type ComplexOption<Value> = { value: Value; label: string; hint?: string>

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@natemoo-re thoughts?

@natemoo-re natemoo-re left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🙌 Thanks, nice fix!

@natemoo-re natemoo-re merged commit c729bf0 into main Feb 26, 2023
@natemoo-re natemoo-re deleted the fix-44_complex_values branch February 26, 2023 22:35
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.

[Request] Support non-string select / multiselect values

2 participants