Skip to content

Commit

Permalink
docs: improve typing of Difficulty in TypeScript example
Browse files Browse the repository at this point in the history
  • Loading branch information
Zwyx committed Sep 7, 2021
1 parent ee047b9 commit 5c54e89
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/typescript.md
Expand Up @@ -126,8 +126,8 @@ interface Arguments {
To improve the `choices` option typing you can also specify its types:

```typescript
type Difficulty = 'normal' | 'nightmare' | 'hell';
const difficulties: ReadonlyArray<Difficulty> = ['normal', 'nightmare', 'hell'];
const difficulties = ["normal", "nightmare", "hell"] as const;
type Difficulty = typeof difficulties[number];

const argv = yargs.option('difficulty', {
choices: difficulties,
Expand Down

0 comments on commit 5c54e89

Please sign in to comment.