arktypea
arktype9mo ago
McKamyk

string.integer.parse < 100

Here's an actual validator I'm trying to build

const decimals = type('string.integer.parse | number.integer < 28')

I want the input to be a number, potentialy in string form, and less than 28.
decimals("20") // passes fine
decimals(20) // passet file
decimals(100) // fails correctly
decimals("100") // passes *should fail*

How do I build a check on the output of the parse?
Was this page helpful?