Skip to content

v2.12.0

Choose a tag to compare

@github-actions github-actions released this 24 Sep 18:49
· 41 commits to main since this release

Breaking!

  • Drop support for TypeScript < 5.0
  • Only .decode(), .verify(), and .value() can still be called when detached from their decoder (e.g. const { transform } = string no longer works). This is unlikely to affect you.

Fixes:

  • Fix oneOf() losing its literal types when nested inside another decoder, no more as const needed:
    // ✅ This was already correct before...
    oneOf(['a', 'b']);
    // Decoder<'a' | 'b'>
    
    // ...but now this is also correct (no longer needs `as const`)
    optional(oneOf(['a', 'b']));
    // Before: ❌ Decoder<string | undefined>
    // Now:    ✅ Decoder<'a' | 'b' | undefined>

Performance:

  • Decoders take ~68% less memory and are ~4x faster to construct.
  • The ~standard API is only built on-demand.