Skip to content

Releases: badrap/valita

v0.1.1

26 Jan 19:03
Compare
Choose a tag to compare
  • Fast path v.record(v.unknown()) and v.object({ ... }).rest(v.unknown()).
  • Fix schemas like v.object({ a: v.string().optional() }).parse({}) failing when it shouldn't.

v0.1.0

30 Nov 00:59
Compare
Choose a tag to compare
v0.1.0

v0.0.26

26 Nov 04:28
Compare
Choose a tag to compare
  • v.record() is equal to v.record(v.unknown())

v0.0.25

11 Nov 15:32
Compare
Choose a tag to compare
v0.0.25

v0.0.24

10 Nov 02:36
Compare
Choose a tag to compare
  • Missing value errors from objects are now all collected:

    const t = v.object({ a: v.string(), b: v.string() });
    t.parse({});
    // ValitaError: missing_value at .b (missing value) (+ 1 other issue)
  • When in strict mode (which is the default) all unrecognized keys in an object are collected into one error:

    const t = v.object({});
    t.parse({ x: 1, y: 2 });
    // ValitaError: unrecognized_keys at . (unrecognized keys "x" and "y")

v0.0.23

09 Nov 01:10
Compare
Choose a tag to compare
v0.0.23

v0.0.22

06 Nov 04:14
Compare
Choose a tag to compare
  • Fix lazy() throwing "Maximum call stack size exceeded" errors (#22)

v0.0.21: Strictly Come Dancing

31 Oct 00:12
Compare
Choose a tag to compare
  • Breaking change: The default parsing mode is now "strict". This means that extra keys for parsed objects cause the parsing to fail by default. For example this now fails:

    import * as v from "@badrap/valita";
    
    const t = v.object({ a: v.number() });
    
    t.parse({ "a": 1, "b": 2 });
    // Uncaught ValitaError: unrecognized_key at . (unrecognized key "b")

    You can go back to the default parsing mode ("passthrough") by giving the mode to .parse(...) (or .try(...)). This will not fail, even with the extra key "b" present:

    t.parse({ "a": 1, "b": 2 }, { mode: "passthrough" });

    You can also opt-in to allowing extra keys case-by-case basis by using .rest(...):

    const t = v.object({ a: v.number() }).rest(v.unknown());
    
    t.parse({ "a": 1, "b": 2 });
    // Succeeds, and the output type is { [x: string]: unknown; a: number; }
  • Docs galore: Huge thanks to @marvinhagemeister for documenting most of the API 🎉 (#20)

v0.0.20

12 Oct 18:11
Compare
Choose a tag to compare

Up transpilation target to es2015 (#18, thanks @marvinhagemeister!)

v0.0.19

18 Sep 22:35
Compare
Choose a tag to compare
0.0.19