You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
yargs(hideBin(process.argv)).parserConfiguration({'unknown-options-as-args': true,}).command(commands).demandCommand(1).completion('completion').strict().help().wrap(120).middleware(middleware).fail((msg: string,err: Error,yargs: Argv)=>{yargs.showHelp();}).onFinishCommand((success)=>{console.log(success);}).scriptName('kit').showHelpOnFail(true,'Sorry, we could not figure out what you want.').version('2.0').epilogue('Epilogue test').argv;
If I remove the onFinishCommand call, it works just fine.
Here is the full error message :
/home/mypc/projects/my-first-yargs-project/src/index.ts:44
.onFinishCommand((success) => {
^
TypeError: yargs_1.default(...).parserConfiguration(...).command(...).demandCommand(...).completion(...).strict(...).help(...).wrap(...).middleware(...).fail(...).onFinishCommand is not a function
at Object.<anonymous> (/home/mypc/projects/my-first-yargs-project/src/index.ts:44:4)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Module.m._compile (/home/mypc/projects/my-first-yargs-project/node_modules/ts-node/src/index.ts:1056:23)
at Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Object.require.extensions.<computed> [as .ts] (/home/mypc/projects/my-first-yargs-project/node_modules/ts-node/src/index.ts:1059:12)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at main (/home/mypc/projects/my-first-yargs-project/node_modules/ts-node/src/bin.ts:198:14)
at Object.<anonymous> (/home/mypc/projects/my-first-yargs-project/node_modules/ts-node/src/bin.ts:288:3)
The text was updated successfully, but these errors were encountered:
@Karizma , OK.
I can still make use of .fail() in conjunction with await to check if all commands have been successfully executed.
Thanks for your time.
onFinishCommand is still included in the latest version of @types/yargs. If it's not included in the JavaScript, shouldn't it be removed from the type declarations too?
code :
If I remove the
onFinishCommand
call, it works just fine.Here is the full error message :
The text was updated successfully, but these errors were encountered: