How to extract ZodFunction from ZodAny? #3335
Replies: 1 comment
-
Nevermind, i solved it export type Schema = Record<
string,
ZodSchema | ZodFunction<any, any> | ZodOptional<ZodFunction<any, any>>
>;
type ToFunction<T> = T extends Function ? T : never
type ExtractFunctions<A extends Schema> = {
[k in keyof A]: ToFunction<Infer<A[k]>>;
};
type Result = ExtractFunctions<Schema> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
ZodFunction<any, any>
from that (Basically for type suggestions)Like this
Func
is justnever
How do i solve this?
Beta Was this translation helpful? Give feedback.
All reactions