Library update: ajv-ts 0.4

Vitali HaradkouVitali Haradkou
1 min read

Table of contents

New Features

Now schema builder supports custom error messages.

import s from 'ajv-ts'

const num = s.number().error('cannot be not a number')

const res1 = num.safeParse("some random string")
const res2 = num.safeParse("1.2")
console.error(res1.error.message) // cannot be not a number
console.error(res2.error.message) // cannot be not a number

res1.error instanceof Error // true

Fixes

  • Issue with installation #21
0
Subscribe to my newsletter

Read articles from Vitali Haradkou directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Vitali Haradkou
Vitali Haradkou

SDET. Certified Node.js Application Developer(JSNAD)