Missing `this` type for `action`
https://github.com/tj/commander.js/blob/83c3f4e391754d2f80b179acc4bccc2d4d0c863d/lib/command.js#L511-L527
The passed action function fn receives the current command as this context in line 523. However, this context is missing in the current typings.
https://github.com/tj/commander.js/blob/83c3f4e391754d2f80b179acc4bccc2d4d0c863d/typings/index.d.ts#L525
Happy to provide a PR for this!
I had seen this recommended in the Effective TypeScript book, but not acted on it as I was not familiar with the pattern (Item 49: Provide a Type for this in Callbacks).
We have more advanced typings and try out some typing improvements in: https://github.com/commander-js/extra-typings
If you open a PR there, we can make it available there first before bringing it back to Commander.
Done with https://github.com/commander-js/extra-typings/pull/59 🎉
The change has been out for a couple of months in https://github.com/commander-js/extra-typings without causing reported issues.
Would you still like to make a PR here @matthyk ?
Absolutely!