How to set a custom message with object type?

Hi guys, I'm new to Arktype, I'm switching from Zod to Arktype with this code:

export const TestSchema = z.object({
  companyName: z
    .string()
    .min(2, "Company name must be at least 2 characters")
    .max(50, "Company name must be less than 50 characters"),
  companyId: z
    .string()
    .min(2, "Company ID must be at least 2 characters")
    .max(50, "Company ID must be less than 50 characters"),
  agreement: z.boolean(),
});


So far, I switched to this in Arktype:

export const TestSchema = type({
  companyName: "2 <= string <= 50",
  companyId: "2 <= string <= 50",
  agreement: "boolean",
});


However, I'm not sure how to set a custom message. All of the documents refer to only one variable. https://arktype.io/docs/configuration#errors. Is there any way to set the error message for best practices? ❤️
TypeScript's 1:1 validator, optimized from editor to runtime
Was this page helpful?