anatine / zod-plugins

Plugins and utilities for Zod
640 stars 89 forks source link

[zod-mock] schema with a .catch() returns undefined #202

Open cabljac opened 4 months ago

cabljac commented 4 months ago

Hi, thanks for this plugin it's awesome. I did run into the following quite quickly


const exampleSchema = z.object({ foo: z.string() }).catch(() => {
// whatever here, even throw a different error
})

const mockObject = generateMock(exampleSchema) // undefined