Can’t define typebox custom error messages

  Kiến thức lập trình

I’m currently learning schema validation for the first time and I’m using typebox, but I can’t define custom error messages for my types. With a prop like:

name: Type.String()

I could attach:

.min(2, { message: "Name must be 2 or more characters long" })

with the Zod lib, but I still haven’t found something like that in typebox docs or discussions. I chose this library because of how lightweight it is, but for now I’ll look into other libraries with react-hook-form. Thanks in advance!

LEAVE A COMMENT