8000 Readonly string array causes type error for `choices` · Issue #103 · kazupon/gunshi · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Readonly string array causes type error for choices #103

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

Closed
4 tasks done
ryoppippi opened this issue Apr 30, 2025 · 0 comments · Fixed by #106
Closed
4 tasks done

Readonly string array causes type error for choices #103

ryoppippi opened this issue Apr 30, 2025 · 0 comments · Fixed by #106
Labels
bug Includes new features

Comments

@ryoppippi
Copy link
Contributor

Describe the bug

When we use readonly array for choices, it causes type mismatch.

import { define } from 'gunshi'

const choices = ['a', 'b'] as const;

const command = define({
    options: {
        foo: {
            type: 'enum',
            choices,
//         ^ The type 'readonly ["a", "b"]' is 'readonly' and cannot be assigned to the mutable type 'string[]'.(4104)
        }
    },
    run(){}
})

Reproduction

https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgEwKYDNgDtVwL5zpQQhwDkA5gK5YDOAFsGQFDMDGEd8b9EwbqWnAC8cANpkAhmQA05AEZkAunElCOXANysNtbiRCSsyESgzZUACgTM4duBDAxgnWgC5Et+9-QQIHm28g+xgATzBUDzJULCoQWS9g7x4+AVoZRKC8TLwM7ygaSwBKBGy8IuYgA

Issue Runtime

Node.js

System Info

System:
    OS: macOS 15.4.1
    CPU: (11) arm64 Apple M3 Pro
    Memory: 122.47 MB / 36.00 GB
    Shell: 3.7.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 23.11.0 - ~/.local/share/devbox/global/default/.devbox/nix/profile/default/bin/node
    Yarn: 1.22.22 - ~/.local/share/devbox/global/default/.devbox/nix/profile/default/bin/yarn
    npm: 10.9.2 - ~/.local/share/devbox/global/default/.devbox/nix/profile/default/bin/npm
    pnpm: 10.8.0 - ~/.local/share/devbox/global/default/.devbox/nix/profile/default/bin/pnpm
    bun: 1.2.10 - ~/.local/share/aquaproj-aqua/bin/bun
  Browsers:
    Chrome: 135.0.7049.115
    Safari: 18.4

Additional context

No response

Validations

  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Includes new features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0