Easier way to chain off of string.integer.parse?

I'm essentially trying to replicate this behavior from Zod:
const numberStringGreaterThan5 = z.coerce.number().gt(5)
numberStringGreaterThan5.parse("6")


The best way I've found to do it with Arktype is with a .narrow , but I'm wondering if theres something simpler
const numberStringGreaterThan5 = type("string.integer.parse").narrow((num, ctx) => (num > 5 ? true : ctx.mustBe("greater than 5")))
numberStringGreaterThan5("6")
Was this page helpful?