Skip to content

fix: use zod/v4/core types for cross-version compatibility#138

Merged
mattapperson merged 1 commit intomainfrom
fix/zod
Jan 9, 2026
Merged

fix: use zod/v4/core types for cross-version compatibility#138
mattapperson merged 1 commit intomainfrom
fix/zod

Conversation

@mattapperson
Copy link
Copy Markdown
Collaborator

@mattapperson mattapperson commented Jan 9, 2026

Summary

Fixes TypeScript type errors when users have a different Zod 4.x minor version than the SDK. The error manifests as:

Type 'ZodString' is not assignable to type '$ZodType<...>'.
  The types of '_zod.version.minor' are incompatible between these types.
    Type '3' is not assignable to type '2'.

This follows Zod's library author guide by using $ZodType, $ZodObject, and $ZodShape from zod/v4/core which are stable across all Zod 4.x versions.

When users have a different Zod 4.x minor version than the SDK, TypeScript
errors occur due to internal version markers (_zod.version.minor) being
incompatible. This follows Zod's library author guide by using $ZodType,
$ZodObject, and $ZodShape from zod/v4/core which are stable across all
Zod 4.x versions.

Changes:
- Update tool-types.ts to import from zod/v4/core
- Update tool.ts to import from zod/v4/core
- Update tool-executor.ts to use $ZodType and z4.parse()
- Configure zod dependency in gen.yaml to persist across regeneration
@mattapperson mattapperson merged commit 5207eaf into main Jan 9, 2026
1 check passed
@mattapperson mattapperson deleted the fix/zod branch January 9, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants