cmd-ts
cmd-ts copied to clipboard
Example of extracting handler argument types?
All the documentation and examples use an inline handler
command({
args: {
foo: ...
},
handler({foo}) {},
})
but I want to define the function separately because it's
command({
args: {
foo: ...
},
handler,
})
function handler(args: unknown) {
}
But it doesn't seem possible to get the type for args.
Same problem here.
I see this type declaration:
declare type HandlerFunc<Args extends ArgTypes> = (args: Output<Args>) => any;
But the Output type isn't exported. If it were, we could easily extract Output<typeof myCommand["args"]>