Skip to content

v0.14.0

Choose a tag to compare

@mertcanaltin mertcanaltin released this 16 May 12:12
· 109 commits to master since this release

v0.14.0 makes ata a first-class citizen for TypeScript users. Validator is now generic with type-narrowing predicates that compose naturally with TypeBox, Zod-from-JSON-Schema, Valibot, or hand-written types over JSON Schema literals. Pure .d.ts change, zero runtime impact.

Added

  • Generic Validator<T> with type predicate isValidObject(data): data is T. Pairs naturally with TypeBox, Zod-from-JSON-Schema, Valibot, or hand-written types over JSON Schema literals.
  • ValidationResult<T> and ValidateAndParseResult<T> are discriminated unions. On the valid: true branch the parsed data is typed; on valid: false the errors array carries the diagnostic information.

Changed

  • Type-level only: accessing result.data (or result.value on validateAndParse) without first checking result.valid is now a TypeScript compile error. Runtime behavior is unchanged. The previous shape returned undefined in that position, so this surfaces an existing latent bug at compile time.

Notes

  • Pure .d.ts change. No JS, C++, AOT, or CLI behavior is affected. Bundle size unchanged. Runtime performance unchanged.