Skip to content

isZod #720

Answered by digimuza
alii asked this question in Q&A
isZod #720
Oct 21, 2021 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

You can easily check

z.ZodType is base class for all zod schemas so you easily can do

const schema = z.object({})
if (schema instanceof z.ZodType) {
// this is zod type
}

If you want more specific checks

if (schema instanceof z.ZodObject) {
// this is zod object type 
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@colinhacks
Comment options

@MentalGear
Comment options

Answer selected by alii
# for free to join this conversation on GitHub. Already have an account? # to comment
Category
Q&A
Labels
None yet
4 participants