We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
It works by using generic types.
const genericFetch = <T>(url: string, schema: z.ZodSchema<T>) => { return fetch(url) .then((res) => res.json()) .then((result) => schema.parse(result)); };