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

[Bug]: Type error when using group select w/out initial value #126

Closed
rschristian opened this issue May 26, 2023 · 2 comments
Closed

[Bug]: Type error when using group select w/out initial value #126

rschristian opened this issue May 26, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@rschristian
Copy link

Environment

  • OS: Linux
  • Node Version: 16.20
  • Package: @clack/prompts
  • Package Version: v0.6.3

Describe the bug
Just a TS error, nothing is functionally wrong.

When using select within group, and initialValue is not provided, the type for value in the options is mistakenly void.

To Reproduce
Minimal Repro

import { group, select } from '@clack/prompts';

(async function create() {
  const { language } = await group({
    language: () =>
      select({
        message: 'Project langauge:',
        // uncomment following line and the error disappears
        //initialValue: 'js',
        options: [
          { value: 'js', label: 'JavaScript' }  // Type 'string' is not assignable to type 'void'. (tsserver 2322)
        ],
      }),
  });
})();

Steps to reproduce the behavior:

  • Follow link
  • Observe error
  • Uncomment the initialValue line
  • Observe error disappearing

Expected behavior
Shouldn't be a type error, AFAIK initialValue does not need to be present, as Clack works perfectly fine without.

@rschristian rschristian added the bug Something isn't working label May 26, 2023
@orochaa
Copy link
Contributor

orochaa commented Jun 12, 2023

PR #102 fixes this bug

@orochaa
Copy link
Contributor

orochaa commented Aug 25, 2023

@cpreston321 PR was merged, this can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants