This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
ajv-ts@0.6.0
Minor Changes
219c7b7: new method: refine.
Inspired from zod. Set custom validation. Any result exept undefined will throws(or exposed for safeParse method).
import s from "ajv-ts";
// example: object with only 1 "active element"
const Schema = s
.object({
active: s.boolean(),
name: s.string(),
})
.array()
.refine((arr) => {
const subArr = arr.filter((el) => el.active === true);
if (subArr.length > 1)
throw new Error('Array should contains only 1 "active" element');
});
Schema.parse([
{ active: true, name: "some 1" },
{ active: true, name: "some 2" },
]); // throws Error: Array should contains only 1 "active" element
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
ajv-ts@0.6.0
Minor Changes
219c7b7: new method:
refine
.Inspired from
zod
. Set custom validation. Any result exeptundefined
will throws(or exposed forsafeParse
method).