bombshell-dev / clack

Effortlessly build beautiful command-line apps
https://clack.cc
5.26k stars 88 forks source link

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

Closed rschristian closed 10 months ago

rschristian commented 1 year ago

Environment

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:

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

Mist3rBru commented 1 year ago

PR #102 fixes this bug

Mist3rBru commented 10 months ago

@cpreston321 PR was merged, this can be closed.