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

@ulkenulken 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.

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

changeset-botBot 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
NameType
@clack/promptsPatch

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 marked this pull request as ready for review February 26, 2023 00:32
@ulken
ulkenforce-pushed the fix-44_complex_values branch from 048f8b4 to c308518CompareFebruary 26, 2023 00:33
@ulken
ulkenforce-pushed the fix-44_complex_values branch from 3b2139c to ca08fb6CompareFebruary 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 }

@ulkenulkenFeb 26, 2023

Copy link
Copy Markdown
CollaboratorAuthor

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?

typePrimitiveOption<ValueextendsPrimitive>={value: Value;label?: string;hint?: string>typeComplexOption<Value>={value: Value;label: string;hint?: string>

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

@natemoo-re thoughts?

@natemoo-renatemoo-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 mainFeb 26, 2023
@natemoo-re
natemoo-re deleted the fix-44_complex_values branch February 26, 2023 22:35
Sign up for freeto 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

@ulken@natemoo-re