The idea behind using yargs is quite appealing.
const argv = yargs.options({
env: {
alias: 'e',
choices: ['dev', 'prod'] as const,
demandOption: true,
description: 'app environment'
}
})
.argv;
console.log(argv);
However, when I explicitly check for argv.env, TypeScript throws an error saying that there is no argv.env. How can I resolve this issue in TypeScript?
if(argv.env == "dev"){ // does not work in TypeScript
...
}