diff --git a/docs/typescript.md b/docs/typescript.md index ecc9d4fd6..9c2eb71a2 100644 --- a/docs/typescript.md +++ b/docs/typescript.md @@ -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 = ['normal', 'nightmare', 'hell']; +const difficulties = ["normal", "nightmare", "hell"] as const; +type Difficulty = typeof difficulties[number]; const argv = yargs.option('difficulty', { choices: difficulties,