-
Notifications
You must be signed in to change notification settings - Fork 1k
onFinishCommand is not a function #1947
Copy link
Copy link
Closed
Description
code :
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)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels