Open BrandenXia opened 3 months ago
Just opened a pull request 😄
Hi @BrandenXia
Thanks for contributing to the repository.
The test workflows fail because the package-lock.json
file is out of sync with package.json
. I tried fixing that locally, but then I got some type errors:
Found 20 errors in 7 files.
Errors Files
3 examples/dependent-prompts.ts:45
3 examples/npm-init.ts:120
1 examples/order-pizza.ts:68
4 src/interactive-command.test.ts:91
4 src/interactive-command.ts:115
4 src/interactive-option.test.ts:76
1 src/interactive-option.ts:51
Would you mind fixing these?
Please let me know once the tests run successfully (npm test
) and we'll take another look at your PR ✌🏼
I just realized that since the signature of chained function in Command
class return Command
instead of InteractiveCommand
, it cannot be typed correctly. A possible solution might be overriding signature of all the chained function (which doesn't work so well). A better solution is to use this
instead of Command
in the function signature in parent class, I might need to make a pull request to @commander-js/extra-typings too. 😂
Edit: According to the readme, using this
will break the type inference. I might need to think of another solution.
@commander-js/extra-typings provide a better support for typescript and works exactly same as the
Command
andOption
in commander.js. The only required change is to add@commander-js/extra-typings
as dependency and inheritCommand
andOption
from@commander-js/extra-typings
instead ofcommander