Skip to content

zodResolver type declaration incompatible with Zod v4 (TS2305: ParseParams) #219

@YevheniiKotyrlo

Description

@YevheniiKotyrlo

Describe the bug

The zodResolver type declaration in @primeuix/forms imports ParseParams from zod:

import type { ParseParams, Schema } from 'zod';

Zod v4 removed ParseParams from its public API (replaced by ParseContext). When a project uses @primeuix/forms with Zod v4 and skipLibCheck: false, TypeScript reports:

error TS2305: Module '"zod"' has no exported member 'ParseParams'.

The devDependencies in @primeuix/forms pin "zod": "^3.23.8", confirming it was built against Zod v3.

Reproducer

mkdir test-zod-resolver && cd test-zod-resolver
npm init -y
npm install @primeuix/forms@0.1.0 zod@4

tsconfig.json:

{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "strict": true,
    "skipLibCheck": false,
    "noEmit": true
  },
  "include": ["*.ts"]
}

test.ts:

import { zodResolver } from '@primeuix/forms/resolvers/zod';

Run: npx tsc --noEmit

Result:

node_modules/@primeuix/forms/dist/resolvers/zod/index.d.mts(1,21):
  error TS2305: Module '"zod"' has no exported member 'ParseParams'.

Root cause

  • Zod v3: parse(data, params?: InexactPartial<ParseParams>) where ParseParams = { path, errorMap, async }
  • Zod v4: parse(data, params?: ParseContext) where ParseContext = { error?, reportInput?, jitless? }
  • ParseParams no longer exists in Zod v4's public API

Suggested fix

Replace ParseParams with Parameters<T['parse']>[1], which automatically infers the correct type from whichever Zod version is installed. Zero runtime impact.

Related: #33, #187

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Needs TriageIssue will be reviewed by Core Team and a relevant label will be added as soon as possible

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions