Skip to content
Source
Sign inSign up
TanStack/form

[v2] Create error map fn #2431

ClosedLeCarbonator(GitHub profile, opens in a new tab)wants to merge 2 commits intoalpha fromcreate-error-map-fnopened

🎯 Changes

Removes parseIssues in favor of adequate replacements:

  • Form-level and group-level validators: parseIssues created an error map, so createErrorMap can be extended to also accept standard schema issues.
  • Field-level validators: parseIssues was redundant, you can just return the array directly.

BREAKING: parseIssues will no longer be available.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm test:pr, or these tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • New Features
    • Standard Schema validation issues can now be returned directly from field validators, while form and group errors can be mapped through createErrorMap.
    • Submission error handling now supports creating error maps from schema issues or supplied error maps.
    • Readonly arrays are now supported for validation error inputs.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Repository: TanStack/form/.coderabbit.yaml
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 6a8be3db-ca54-4798-a13a-32e59a6afbb7
      📥 Commits

      Reviewing files that changed from the base of the PR and between 3d3907734521024f54fd6f66e4fd591ee9abcae4 and 6c2d57702250fb60ee13421f4695f5438a4453d5.

      📒 Files selected for processing: 23
      • examples/angular/field-groups/src/bound-field.component.ts
      • examples/lit/field-groups/src/field-bounds.ts
      • examples/preact/field-groups/src/fieldGroups/fieldBounds.tsx
      • examples/react/field-groups/src/fieldGroups/fieldBounds.tsx
      • examples/solid/field-groups/src/fieldGroups/fieldBounds.tsx
      • examples/svelte/field-groups/src/fieldGroups/UpperBoundFields.svelte
      • packages/form-core/src/FormApi/FormApi.public.ts
      • packages/form-core/src/FormApi/handleSubmit.lib.ts
      • packages/form-core/src/FormGroupApi/FormGroupApi.lib.ts
      • packages/form-core/src/createErrorMap.lib.ts
      • packages/form-core/src/ssr.lib.ts
      • packages/form-core/src/types.public.ts
      • packages/form-core/src/utils.lib.ts
      • packages/form-core/src/validation.public.ts
      • packages/form-core/src/validation/execution.lib.ts
      • packages/form-core/src/validation/mount.lib.ts
      • packages/form-core/src/validation/pipeline.lib.ts
      • packages/form-core/tests/FormApi/submission-handling.spec.ts
      • packages/form-core/tests/FormApi/validation.spec.ts
      • packages/form-core/tests/FormGroupApi/FormGroupApi.spec.ts
      • packages/form-core/tests/validation-pipeline.test.ts
      • packages/form-core/tests/validation-public.test.ts
      • packages/form-core/tests/validation.test-d.ts
      💤 Files with no reviewable changes: 1
      • packages/form-core/tests/validation-public.test.ts

      Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

      📝 Walkthrough

      Validation and submission contexts now use createErrorMap instead of parseIssues. Field validators can return Standard Schema issue arrays directly. The public validation types accept readonly inputs, and the field-group examples use the updated validation pattern.

      Changes: Form Error Mapping

      Layer / File(s)Summary
      Error-map and readonly input contracts
      packages/form-core/src/types.public.ts, packages/form-core/src/utils.lib.ts, packages/form-core/src/validation.public.ts, packages/form-core/tests/validation-public.test.ts, packages/form-core/tests/validation.test-d.ts
      Validation error inputs now accept readonly values. CreateErrorMapFn has overloads for error maps and Standard Schema issues. The standalone createErrorMap export and the parseIssues type declarations are removed.
      Validation error routing
      packages/form-core/src/createErrorMap.lib.ts, packages/form-core/src/validation/*, packages/form-core/src/FormGroupApi/FormGroupApi.lib.ts, packages/form-core/src/ssr.lib.ts, examples/*/field-groups/*, packages/form-core/tests/FormApi/validation.spec.ts, packages/form-core/tests/FormGroupApi/FormGroupApi.spec.ts, packages/form-core/tests/validation-pipeline.test.ts, packages/form-core/tests/validation.test-d.ts
      Form and group validation contexts create error maps using current values. Field validators return Standard Schema issues directly. Examples and tests use these updated patterns.
      Submission error maps
      packages/form-core/src/FormApi/FormApi.public.ts, packages/form-core/src/FormApi/handleSubmit.lib.ts, packages/form-core/tests/FormApi/submission-handling.spec.ts, packages/form-core/tests/validation.test-d.ts
      The submit context provides createErrorMap with overloads for error maps and Standard Schema issues. Submission errors retain the map, and submission documentation and tests use the new helper.

      Priority: ➖ Normal

      Estimated code review effort: 3 (Moderate) | ~25 minutes

      Change: Feature

      Suggested reviewers: crutchcorn

      Merge Risk: ⚪ Minimal · up to 6c2d5

      This change replaces issue parsing with createErrorMap and lets field validators return schema issues directly. No concrete merge-blocking problem was identified. The PR is declared breaking, so the release checklist and changeset still need attention.

      Pre-merge checks: Passed 3 · Failed 2
      Failed Failed checks: 2 warnings
      Check nameStatusExplanationResolution
      Description checkWarningThe description explains the removal of parseIssues and lists the main replacements. However, this breaking published API change does not include a changeset, and the test-status checklist remains inc…Add the required changeset for the published breaking API change, select the applicable Release Impact option, and confirm whether pnpm test:pr was run or does not apply.
      Docstring CoverageWarningDocstring coverage is 38.89% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 21 files. (1 skipped:…Write docstrings for the functions missing them to satisfy the coverage threshold.
      Passed Passed checks: 3 passed
      Check nameStatusExplanation
      Title checkPassedThe title clearly identifies the main change: creating an error map function as part of the v2 API update.
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Full details: Description check

      Explanation

      The description explains the removal of parseIssues and lists the main replacements. However, this breaking published API change does not include a changeset, and the test-status checklist remains incomplete.

      Resolution

      Add the required changeset for the published breaking API change, select the applicable Release Impact option, and confirm whether pnpm test:pr was run or does not apply.

      Full details: Docstring Coverage

      Explanation

      Docstring coverage is 38.89% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 18 functions across 21 files. (1 skipped: 1 unsupported.)

      Resolution

      Write docstrings for the functions missing them to satisfy the coverage threshold.

      • Fix all pre-merge checks with AI
      ✨ Finishing Touches: 💡 2
      📝 Generate docstrings: 💡
      • Commit to this branch
      • Create a new PR
      🛠️ Fix failing CI checks: 💡
      • Commit to this branch
      • Create a new PR
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. nx-cloud[bot](GitHub profile, opens in a new tab)commented

      View your CI Pipeline Execution ↗ for commit 6c2d57702250fb60ee13421f4695f5438a4453d5

      CommandStatusDurationResult
      nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded4m 18sView ↗
      nx run-many --target=build --exclude=examples/**✅ Succeeded21sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-10-16 09:00:23 UTC

    3. 🚀 Changeset Version Preview

      8 package(s) bumped directly, 5 bumped as dependents.

      🟨 Minor bumps

      PackageVersionReason
      @tanstack/angular-form2.0.0-alpha.2 → 2.0.0-alpha.3Changeset
      @tanstack/form-core2.0.0-alpha.2 → 2.0.0-alpha.3Changeset
      @tanstack/lit-form2.0.0-alpha.2 → 2.0.0-alpha.3Changeset
      @tanstack/preact-form2.0.0-alpha.2 → 2.0.0-alpha.3Changeset
      @tanstack/react-form2.0.0-alpha.2 → 2.0.0-alpha.3Changeset
      @tanstack/solid-form2.0.0-alpha.2 → 2.0.0-alpha.3Changeset
      @tanstack/svelte-form2.0.0-alpha.2 → 2.0.0-alpha.3Changeset
      @tanstack/vue-form2.0.0-alpha.2 → 2.0.0-alpha.3Changeset
      @tanstack/react-form-nextjs2.0.0-alpha.2 → 2.0.0-alpha.3Dependent
      @tanstack/react-form-start2.0.0-alpha.2 → 2.0.0-alpha.3Dependent

      🟩 Patch bumps

      PackageVersionReason
      @tanstack/form-devtools1.0.0-alpha.2 → 1.0.0-alpha.3Dependent
      @tanstack/react-form-devtools1.0.0-alpha.2 → 1.0.0-alpha.3Dependent
      @tanstack/solid-form-devtools1.0.0-alpha.2 → 1.0.0-alpha.3Dependent
    4. More templates

      @tanstack/angular-form

      npm i https://pkg.pr.new/@tanstack/angular-form@2431

      @tanstack/form-core

      npm i https://pkg.pr.new/@tanstack/form-core@2431

      @tanstack/form-devtools

      npm i https://pkg.pr.new/@tanstack/form-devtools@2431

      @tanstack/lit-form

      npm i https://pkg.pr.new/@tanstack/lit-form@2431

      @tanstack/preact-form

      npm i https://pkg.pr.new/@tanstack/preact-form@2431

      @tanstack/react-form

      npm i https://pkg.pr.new/@tanstack/react-form@2431

      @tanstack/react-form-devtools

      npm i https://pkg.pr.new/@tanstack/react-form-devtools@2431

      @tanstack/react-form-nextjs

      npm i https://pkg.pr.new/@tanstack/react-form-nextjs@2431

      @tanstack/react-form-start

      npm i https://pkg.pr.new/@tanstack/react-form-start@2431

      @tanstack/solid-form

      npm i https://pkg.pr.new/@tanstack/solid-form@2431

      @tanstack/solid-form-devtools

      npm i https://pkg.pr.new/@tanstack/solid-form-devtools@2431

      @tanstack/svelte-form

      npm i https://pkg.pr.new/@tanstack/svelte-form@2431

      @tanstack/vue-form

      npm i https://pkg.pr.new/@tanstack/vue-form@2431

      commit: 6c2d577

    5. :warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

      Codecov Report

      :white_check_mark: All modified and coverable lines are covered by tests. :warning: Please upload report for BASE (alpha@3d39077). Learn more about missing BASE report. :exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

      Additional details and impacted files
      @@           Coverage Diff            @@
      ##             alpha    #2431   +/-   ##
      ========================================
        Coverage         ?   95.10%           
      ========================================
        Files            ?      116           
        Lines            ?     4456           
        Branches         ?     1005           
      ========================================
        Hits             ?     4238           
        Misses           ?      208           
        Partials         ?       10           

      :umbrella: View full report in Codecov by Harness. :loudspeaker: Have feedback on the report? Share it here.

      :rocket: New features to boost your workflow:

      • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
      • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
  • Not going to be tackled this way after all. Too many implications for a minor QoL improvement.

  • Sign in to join this conversation.