0
Follow
0
View

How to create a type for file type `Record` in zod

guoguo2010814 注册会员
2023-01-25 20:39

Maybe z.instanceof can solve it?

If you want to validate the File type ...

z.instanceof (File)

Or, for FileList type...

z.instanceof (FileList)


https://github.com/colinhacks/zod/issues/387

dingyungao1 注册会员
2023-01-25 20:39

zodSchema:

  file:
    typeof window === "undefined"
      ? z.string()
      : record(any()).nullable(),

initialValues:

file: "undefined",

About the Author

Question Info

Publish Time
2023-01-25 20:39
Update Time
2023-01-25 20:39

Related Question