import { z } from "zod"; export const fn = ({ input, output }: { input: TInput; output: TOutput }) => { const schema = z.function({ input: z.tuple(input), output, }); return z .custom, TOutput>>((arg) => typeof arg === "function") .transform((arg) => schema.implement(arg)); }; export const asyncFn = ({ input, output, }: { input: TInput; output: TOutput; }) => { const schema = z.function({ input: z.tuple(input), output, }); return z .custom, TOutput>>((arg) => typeof arg === "function") .transform((arg) => schema.implementAsync(arg)); };