The concept of yargs is nice.
const argv = yargs.options({
env: {
alias: 'e',
choices: ['dev', 'prod'] as const,
demandOption: true,
description: 'app environment'
}
})
.argv;
console.log(argv);
But if I check argv.env explicit, typescript say: There is no argv.env. How can I solve this in typescript?
if(argv.env == "dev"){ // not work in typescript
...
}