Skip to content

v0.4.0

Choose a tag to compare

@github-actions github-actions released this 16 Jan 14:48
7c31815

Minor Changes

  • 2b4dd9e: # Description

    Add support for custom error message for any error.

    Example:

    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

    What's new

    new feature: add support custom error message

    Fixes

    fix: issue with typescript #21

    Thanks

    @rjvim for submitting the issue