Skip to content

Releases: lawvs/zod-compare

v3.2.0

Choose a tag to compare

@github-actions github-actions released this 15 Jun 06:37
0dbdc99

Minor Changes

  • #116 56bc2cf Thanks @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 empty z.union([]) and z.xor([]) schemas, including nested empty unions, as never for TypeScript-level same-type and compatibility checks. It also keeps z.undefined() object properties required and clarifies runtime-only comparison warnings while leaving strict runtime behavior to custom rules.

Patch Changes

  • c9d3c0b Thanks @lawvs! - Fix TypeScript 6 declaration output so published packages include dist/index.d.ts instead of only dist/src/index.d.ts.

v3.1.0

Choose a tag to compare

@github-actions github-actions released this 09 Jun 08:43
b3f71b8

Minor Changes

  • #114 6cc59d3 Thanks @lawvs! - Update isCompatibleType to 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

Choose a tag to compare

@github-actions github-actions released this 14 Feb 08:35
48e37db

Major Changes

  • #100 7801de3 Thanks @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.0 to zod: ^4.0.0. Zod v3 is no longer supported.
    • Removed sub-exports: zod-compare/zod3 and zod-compare/zod4 entry points have been removed. Use the main zod-compare entry point instead.
    • Removed version utilities: isZod3Schema, isZod4Schema, and haveSameZodMajor are no longer exported.
    • Simplified API surface: isSameType and isCompatibleType now 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";

v2.0.1

Choose a tag to compare

@github-actions github-actions released this 11 Jan 18:22
a842f6d

Patch Changes

v2.0.0

Choose a tag to compare

@github-actions github-actions released this 23 Sep 16:43

Major Changes

  • #84 3e0bbf0 Thanks @lawvs! - Add first-class compatibility with Zod v4.

    • New entry point: zod-compare/zod4 exposes 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 isSameType and isCompatibleType throw 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";

v1.1.0

Choose a tag to compare

@github-actions github-actions released this 21 Jun 16:26
e84daf7

Minor Changes

v1.0.0

Choose a tag to compare

@github-actions github-actions released this 05 Oct 16:50
d9373da

Major Changes

v0.3.1

Choose a tag to compare

@github-actions github-actions released this 03 Jul 10:58
6bfef54

Patch Changes

  • 95175c4: feat: add compare result to debug stack

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 07 May 08:42
3483795

Minor Changes

  • b40d479: refactor: redesign isCompatibleType with new rule style

    The function createIsSameTypeFn has been renamed to createCompareFn.

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 06 May 13:27
70d8a21

Minor Changes

  • ff25a46: refactor!: replace misc options with middleware

    BREAKING CHANGE: The options object has been removed and replaced with custom rules.