Sorry if this is a dumb question, this is my code:
export const InsertFeaturedWorkFormSchema = z.object({ title: z.string() .min(3, "Title must be at least 3 characters") .max(60, "Title must not exceed 60 characters"), description: z.string() .min(10, "Description must be at least 10 characters") .max(1000, "Description must not exceed 1000 characters"), bannerImage: z.file() .min(mbToBytes(0.01), {message: "File size must be at least 10KB" }) .max(mbToBytes(10), {message: "File size must not exceed 10MB" }),});const form = useAppForm({ defaultValues: { title: "", description: "", bannerImage: null, }, validators: {onSubmit: InsertFeaturedWorkFormSchema}, onSubmit: async ({value}: { value: CreateFeaturedWorkFormData }) => {...submit...}, });
export const InsertFeaturedWorkFormSchema = z.object({ title: z.string() .min(3, "Title must be at least 3 characters") .max(60, "Title must not exceed 60 characters"), description: z.string() .min(10, "Description must be at least 10 characters") .max(1000, "Description must not exceed 1000 characters"), bannerImage: z.file() .min(mbToBytes(0.01), {message: "File size must be at least 10KB" }) .max(mbToBytes(10), {message: "File size must not exceed 10MB" }),});const form = useAppForm({ defaultValues: { title: "", description: "", bannerImage: null, }, validators: {onSubmit: InsertFeaturedWorkFormSchema}, onSubmit: async ({value}: { value: CreateFeaturedWorkFormData }) => {...submit...}, });
problem is when i pass null for bannerImage I got ts error
Type null is not assignable to type File
Type null is not assignable to type File
- okay expected, but how can I provide default value for it, or moreover, should I provide a default value, whats correct way to do this