Z
Zod4mo ago
CommandMC

CommandMC - z.function().args() seems to forget...

z.function().args() seems to forget brands? Hello. Using a branded schema as an argument to a Zod function (z.function()) & then inferring the type of that function doesn't seem to be working correctly, the argument type just reverts to its non-branded type TS Playground example of my issue
1 Reply
CommandMC
CommandMCOP4mo ago
Seems that for this specific case, using the following would work around the issue:
type argT = z.infer<ReturnType<typeof funcExample.parameters>>[0]
type argT = z.infer<ReturnType<typeof funcExample.parameters>>[0]
Sadly that doesn't help much for my use case, I need the correct type from just the output type of the function My use case is something more alike to this: Playground Link
Want results from more Discord servers?
Add your server