Skip to content

Browser File api for nextjs #263

Answered by QzCurious
QzCurious asked this question in Q&A
Discussion options

You must be logged in to vote

I've found my problem also asked on a zod issue. Instead of z.instanceof(File) which would not be valid on server side, @zanzlender has a great way to validate the input (the check might only be valid on client side).

I'm making it more type safe with

z.any() as ZodType<File>

And I'm satisfied with it.

UPDATE!!
zod recently document the feature for custom schema. (seem like this method already being there for a while)

z.custom<File>()

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@QzCurious
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by QzCurious
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants