Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowspawn committed Dec 31, 2024
2 parents 5a90c8f + e53229b commit 1359878
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ Use a "const assertion" on the choices to narrow the option type from `string`:

```typescript
const program = new Command()
.addOption(new Option('--drink-size <size>').choices(['small', 'medium', 'large'] as const))
.parse();
.addOption(
new Option('--drink-size <size>')
.choices(['small', 'medium', 'large'] as const)
// if you want to provide a default option, also add a const assertion to it
.default('medium' as const)
).parse();
const drinkSize = program.opts().drinkSize; // "small" | "medium" | "large" | undefined
```

0 comments on commit 1359878

Please sign in to comment.