【发布时间】:2021-08-02 15:53:05
【问题描述】:
yargs 的概念很好。
const argv = yargs.options({
env: {
alias: 'e',
choices: ['dev', 'prod'] as const,
demandOption: true,
description: 'app environment'
}
})
.argv;
console.log(argv);
但如果我明确检查 argv.env,打字稿会说:没有 argv.env。如何在打字稿中解决这个问题?
if(argv.env == "dev"){ // not work in typescript
...
}
【问题讨论】:
标签: typescript yargs