-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
export const UserSchema = z.object({
email: z.string().unique(),
password: z.string(),
firstName: z.string(),
lastName: z.string(),
});
const schema = zodSchemaRaw(UserSchema);
const userSchema = new Schema(schema, {
toJSON: { virtuals: false, getters: true },
});
userSchema.pre("save", async function (next) {
if (!this.isModified("password")) return next();
const salt = await bcrypt.genSalt(10);
this.password = await bcrypt.hash(this.password, salt); //Argument of type '_Field<ZodString> | _Schema<ZodString>' is not assignable to parameter of type 'string | Buffer'.
// Type '_Field<ZodString>' is not assignable to type 'string | Buffer'
});
It may be related to the same return types as in #3 but for zodSchemaRaw
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request