Ajv-ts reached 0.7! 🎉

Ajv-ts reached 0.7! 🎉

Note: The library is not an official ajv extension

What’s up, guys! Today I will show you massive product update for the library inspired by zod – ajv-ts. Release link – here

Why have there been no updates for a long time? Well, the previous release was on 1 Feb 2024. The release date for 0.7 is 4 July 2024. That’s because I’m working on this library in my free time and out of work.

Error map

extend the error method for mapping custom messages. Originally works from ajv-errors and examples from this docs are works

examples:

const a = s.string().error({ _: any error here, type: not a string. Custom });

a.parse(123); // throws “not a string. Custom”

Strict type checking length/minLength/maxLength for string and array

Just see in action:

import s from ajv-ts;
s.string().minLength(3).maxLength(1); // error. MaxLength < MinLength

s.array().minLength(4).maxLength(2); // error. MaxLength < MinLength

s.string().length(1); // error. Length is negative

conclusion

Well, mostly that’s it. Again, you can see the release 0.7 here.

What’s next?

I already have a to-do list of new features, like three-shaking, and strict pre/post processing with TS autocomplete. Will see what lands first!

Take care!

Please follow and like us:
Pin Share