-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
What happened?
I use drizzle-zod to create an InsertSchema like so:
import type z from "zod/v4";
import { createInsertSchema } from "drizzle-zod";
export const InsertLocation = createInsertSchema(location, {
name: field => field.min(1).max(100),
description: field => field.max(1000),
lat: field => field.min(-90).max(90),
long: field => field.min(-180).max(180),
}).omit({
id: true,
slug: true,
userId: true,
createdAt: true,
updatedAt: true,
});
export type InsertLocation = z.infer<typeof InsertLocation>;
Then I want to use the toTypedSchema() method from vee-validate like so:
const { handleSubmit, errors, meta, setErrors, setFieldValue, controlledValues } = useForm({
validationSchema: toTypedSchema(InsertLocation),
initialValues: {
name: "",
description: "",
long: (CENTER_CN as [number, number])[0],
lat: (CENTER_CN as [number, number])[1],
},
});
But I got the type error below:
Argument of type 'ZodObject<{ name: ZodString; description: ZodNullable<ZodString>; lat: ZodNumber; long: ZodNumber; }, { out: {}; in: {}; }>' is not assignable to parameter of type 'ZodType<any, ZodTypeDef, any>'.
Type 'ZodObject<{ name: ZodString; description: ZodNullable<ZodString>; lat: ZodNumber; long: ZodNumber; }, { out: {}; in: {}; }>' is missing the following properties from type 'ZodType<any, ZodTypeDef, any>': _type, _parse, _getType, _getOrReturnCtx, and 7 more.ts-plugin(2345)
Reproduction steps
...
Version
Vue.js 3.x and vee-validate 4.x
What browsers are you seeing the problem on?
- Firefox
- Chrome
- Safari
- Microsoft Edge
Relevant log output
Demo link
no
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
No labels