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

TypeScript should allow undefined in args.default #180

Open
jcalfee opened this issue Jan 26, 2025 · 1 comment
Open

TypeScript should allow undefined in args.default #180

jcalfee opened this issue Jan 26, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@jcalfee
Copy link

jcalfee commented Jan 26, 2025

Environment

citty ^0.1.6

Reproduction

const c = defineCommand({
  args: {
    accountId: {
      type: 'string',
      description: '[env: ACCOUNT_ID]',
      default: process.env.ACCOUNT_ID,
      required: true
    },
// ...

Describe the bug

I have environment variables and I would like to pass them though the args.default so the CLI has a chance to change the values. When I do that, process.env.ANY_VAR could be string | undefined. This causes a typescript error when I try to use that in citty.

Image

Image

Additional context

No response

Logs

@jcalfee jcalfee added the bug Something isn't working label Jan 26, 2025
@jcalfee
Copy link
Author

jcalfee commented Jan 26, 2025

Possibly related #132

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

1 participant