Releases: lawvs/zod-compare
Release list
v3.2.0
Minor Changes
-
#116
56bc2cfThanks @lawvs! - Add comparison support for Zod 4.3 and 4.4 schema updates.Zod 4.3 support covers schema variants including
z.xor(),z.looseRecord(), and.exactOptional(). Zod 4.4 support treats emptyz.union([])andz.xor([])schemas, including nested empty unions, asneverfor TypeScript-level same-type and compatibility checks. It also keepsz.undefined()object properties required and clarifies runtime-only comparison warnings while leaving strict runtime behavior to custom rules.
Patch Changes
v3.1.0
Minor Changes
-
#114
6cc59d3Thanks @lawvs! - UpdateisCompatibleTypeto use the(expectedType, providedType)assignability model and improve TypeScript-like compatibility checks for optional and nullable wrappers, unions, finite literal and enum values, arrays, tuples, objects, records, maps, and sets.Document that Zod 4 brands are type-only and compare like their underlying runtime schema.
v3.0.0
Major Changes
-
#100
7801de3Thanks @copilot-swe-agent! - Drop Zod v3 support. Zod v4 is now the sole supported version.Breaking Changes
- Peer dependency: Changed from
zod: ^3.25.0 || ^4.0.0tozod: ^4.0.0. Zod v3 is no longer supported. - Removed sub-exports:
zod-compare/zod3andzod-compare/zod4entry points have been removed. Use the mainzod-compareentry point instead. - Removed version utilities:
isZod3Schema,isZod4Schema, andhaveSameZodMajorare no longer exported. - Simplified API surface:
isSameTypeandisCompatibleTypenow only accept Zod v4 schemas. Mixed-version comparison (which previously threw) is no longer possible.
Migration
- import { isSameType } from "zod-compare/zod4"; + import { isSameType } from "zod-compare";
- Peer dependency: Changed from
v2.0.1
v2.0.0
Major Changes
-
#84
3e0bbf0Thanks @lawvs! - Add first-class compatibility with Zod v4.- New entry point:
zod-compare/zod4exposes the same comparison APIs for Zod v4 - Peer dependency widened to
zod: ^3.25.0 || ^4.0.0 - No breaking changes for Zod v3 users
Notes:
- Mixed-major comparisons are not supported at runtime. When Zod majors differ, both
isSameTypeandisCompatibleTypethrow an error.
Usage:
// Zod v4 import { z } from "zod/v4"; import { isSameType, isCompatibleType } from "zod-compare/zod4"; // Zod v3 import { z as z3 } from "zod"; import { isSameType as isSameV3, isCompatibleType as isCompatV3, } from "zod-compare/zod3";
- New entry point:
v1.1.0
v1.0.0
v0.3.1
Patch Changes
- 95175c4: feat: add compare result to debug stack
v0.3.0
Minor Changes
-
b40d479: refactor: redesign isCompatibleType with new rule style
The function
createIsSameTypeFnhas been renamed tocreateCompareFn.
v0.2.0
Minor Changes
-
ff25a46: refactor!: replace misc options with middleware
BREAKING CHANGE: The
optionsobject has been removed and replaced with custom rules.