Reproduction
@Args() depends on the selected Command invocation and therefore cannot be injected into a constructor:
src/deploy.command.ts
import { Args, Command, Handler } from 'func'
import type { Args as CommandArgs } from 'func'
@Command('deploy')
class DeployCommand {
constructor(@Args() args: CommandArgs) {}
@Handler()
run() {}
}How to fix it
Move the parameter to an @Handler() method:
src/deploy.command.ts
class DeployCommand {
@Handler()
run(@Args() args: CommandArgs) {
console.log(args.inputs)
}
}When a constructor needs invocation context, inject Context instead. details.target and details.index identify the invalid class and parameter position.