2

私はこのコードを持っていました

const argv = yargs
    .option("applyChanges", {
        alias: "a",
        description: "Apply the changes",
        type: "boolean"
    })
    .help()
    .alias("help", "h").argv;

const options = {
    applyChanges: argv.applyChanges ? argv.applyChanges : false
};

argv.applyChangesブール値を取得します。しかし、yargs 17 への最新の更新後、次のエラーが表示されargv.applyChangesます。

プロパティ 'applyChanges' は型 '{ [x: string]: 不明; に存在しません。applyChanges: ブール値 | 未定義; _: (文字列 | 数値)[]; $0: 文字列; } | Promise<{ [x: 文字列]: 不明; applyChanges: ブール値 | 未定義; _: (文字列 | 数値)[]; $0: 文字列; }>'. プロパティ 'applyChanges' は型 'Promise<{ [x: string]: 不明; に存在しません。applyChanges: ブール値 | 未定義; _: (文字列 | 数値)[]; $0: 文字列; }>'.

使用しようとしましawaitたが、成功しませんでした。私は何をすべきか?このコードは、以前の yargs バージョン 16.xx で動作していました。

4

1 に答える 1