Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formErrors.map(error) has broken type inference #1325

Open
theVedanta opened this issue Mar 23, 2025 · 0 comments
Open

formErrors.map(error) has broken type inference #1325

theVedanta opened this issue Mar 23, 2025 · 0 comments

Comments

@theVedanta
Copy link
Contributor

theVedanta commented Mar 23, 2025

Describe the bug

Image

The {error} of type void or undefined. This is directly highlighted in one of the examples: https://tanstack.com/form/latest/docs/framework/react/examples/next-server-actions

You can see right before it, the error is casted as a string or unknown however, this would be better solved in a case especially with mergeForm/server-validations.

I will try to trace back the code causing this and raise a PR.

Your minimal, reproducible example

https://tanstack.com/form/latest/docs/framework/react/examples/next-server-actions

Steps to reproduce

Download the project for highlighting of the type inference error.

Expected behavior

I would expect this to be similar to field-level error:

UnwrapOneLevelOfArray<UnwrapFieldValidateOrFn<{
    firstName: string;
    age: number;
}, "age", ({ value }: {
    value: number;
    fieldApi: FieldApi<{
        firstName: string;
        age: number;
    }, "age", number, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
}) => "Client validation: You must be at least 8" | undefined, ({ value }: {
    ...;
}) => void>>

How often does this bug happen?

Every time

Screenshots or Videos

Image

Platform

All.

TanStack Form adapter

react-form

TanStack Form version

v0.43.2 (form-core)

TypeScript version

v5.6.3

Additional context

No response

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

No branches or pull requests

1 participant