I'm creating a register form with RegisterSchema. It have custom validation that check wether password and confirm_password is similar or not.
const RegisterSchema = v.pipe(
v.object({
username: v.pipe(v.string(), v.minLength(3), v.maxLength(20)),
name: v.pipe(v.string(), v.minLength(1), v.maxLength(50)),
email: v.pipe(v.string(), v.email()),
password: v.pipe(v.string(), v.minLength(8), v.maxLength(20)),
confirm_password: v.pipe(v.string(), v.minLength(8), v.maxLength(20)),
}),
v.check(
(input) => input.confirm_password === input.password,
"Password tidak cocok",
),
);
type RegisterForm = v.InferInput<typeof RegisterSchema>;
const [registerForm, { Form, Field, FieldArray }] = useForm<RegisterForm>({
loader: useFormLoader(),
validate: valiForm$(RegisterSchema),
});
I got this error with valiForm$ with RegisterSchema argument.
Type 'SchemaWithPipe<[ObjectSchema<{ readonly username: SchemaWithPipe<[StringSchema<undefined>, MinLengthAction<string, 3, undefined>, MaxLengthAction<string, 20, undefined>]>; readonly name: SchemaWithPipe<...>; readonly email: SchemaWithPipe<...>; readonly password: SchemaWithPipe<...>; readonly confirm_password: Schem...' is missing the following properties from type 'GenericSchema<unknown, unknown, BaseIssue<unknown>>': '~standard', '~vendor', '~validate'```
I don't know why. I'm sure I followed the docs.