Skip to content

fix(form-core): exclude undefined from errors type to match runtime behavior#2023

Open
JaeSeoKim wants to merge 1 commit intoTanStack:mainfrom
JaeSeoKim:fix-errors-undefined
Open

fix(form-core): exclude undefined from errors type to match runtime behavior#2023
JaeSeoKim wants to merge 1 commit intoTanStack:mainfrom
JaeSeoKim:fix-errors-undefined

Conversation

@JaeSeoKim
Copy link

🎯 Changes

The runtime implementation filters out undefined values from errorMap, but the type definition included undefined in the union types. This caused type errors when accessing error properties without undefined checks.

Wrap the errors type union with Exclude<..., undefined> in both FormApi and FieldApi to align the type system with the actual runtime behavior.

Closes #2022

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm test:pr.

🚀 Release Impact

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

…ehavior

The runtime implementation filters out undefined values from errorMap,
but the type definition included undefined in the union types. This
caused type errors when accessing error properties without undefined
checks.

Wrap the errors type union with Exclude<..., undefined> in both FormApi
and FieldApi to align the type system with the actual runtime behavior.

Closes TanStack#2022
@changeset-bot
Copy link

changeset-bot bot commented Feb 5, 2026

🦋 Changeset detected

Latest commit: ad62fd9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@tanstack/react-form-nextjs Patch
@tanstack/react-form-remix Patch
@tanstack/form-core Patch
@tanstack/angular-form Patch
@tanstack/form-devtools Patch
@tanstack/lit-form Patch
@tanstack/react-form Patch
@tanstack/solid-form Patch
@tanstack/svelte-form Patch
@tanstack/vue-form Patch
@tanstack/react-form-devtools Patch
@tanstack/solid-form-devtools Patch
@tanstack/react-form-start Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

Bug Report: Type mismatch in errors field - runtime filtering of undefined not reflected in type definition

1 participant