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

BUG: REACT HOOK FORM register type max input is a number ERROR #4566

Closed
VigilioYonatan opened this issue Nov 23, 2024 · 3 comments · Fixed by #4568
Closed

BUG: REACT HOOK FORM register type max input is a number ERROR #4566

VigilioYonatan opened this issue Nov 23, 2024 · 3 comments · Fixed by #4568

Comments

@VigilioYonatan
Copy link

  • [x ] Check if updating to the latest Preact version resolves the issue

Describe the bug
React hook form method register have a type max input like number and input preact is Signalish<string | undefined> .

import { useForm } from "react-hook-form";

export function App() {
    const { register } = useForm<{ name: string }>();
    return (
        <>
            <input type="text" {...register("name")} />
        </>
    );
}

To Reproduce
https://codesandbox.io/p/sandbox/error-input-react-hook-form-y8rprh

Steps to reproduce the behavior:

  1. example but no show error, but in vite js it happen
  2. npm init vite@latest app
  3. choose preact typescript and install dependencies.
  4. install react hook form

SOLUTION
Expected behavior
the solution is that min and max add number
min?: Signalish<string | undefined|number>;
MAX?: Signalish<string | undefined|number>;

@rschristian
Copy link
Member

rschristian commented Nov 23, 2024

I don't think your sandbox is public, mind making it so?

Edit: Nevermind, no need.

@VigilioYonatan
Copy link
Author

I don't think your sandbox is public, mind making it so?

Edit: Nevermind, no need.

yes, it no neccesary, solution is add number in min and max type in input or react hook form add string min and max. React hook form is the library most used in react.

@rschristian
Copy link
Member

Maintainers would generally prefer you leave that determination up to them. The number of times we've been told a reproduction isn't necessary when it very much was... 😄

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 a pull request may close this issue.

2 participants