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

Cannot refer to FiledInfo of tanstack form with ReturnType #976

Open
k70suK3-k06a7ash1 opened this issue Oct 13, 2024 · 0 comments
Open

Comments

@k70suK3-k06a7ash1
Copy link

Describe the bug

const useCustomForm = () => {
  // Custom form logic
  const form = useFrom();
  // Return form object
  return { form }
}

const useSomething = () => {
  type FormProperties = ReturnType<typeof useCustomForm>['form']['fieldInfo'];

  const handleSomething = (from: FieldApi<FormProperties, 'photo', undefined, undefined, string>) => {
    // Handle something logic
  }

  // Return handleSomething function
  return { handleSomething }
}

Your minimal, reproducible example

https://codesandbox.io/p/sandbox/inspiring-dew-c7y3rl

Steps to reproduce

Image

Expected behavior

Expect tsc --noEmit to pass

How often does this bug happen?

None

Screenshots or Videos

No response

Platform

  • OS [masOS]

TanStack Form adapter

None

TanStack Form version

0.33.0

TypeScript version

5.5.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