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 figure how to use useStateValidator #2019

Open
AuthorProxy opened this issue May 24, 2021 · 2 comments
Open

Cannot figure how to use useStateValidator #2019

AuthorProxy opened this issue May 24, 2021 · 2 comments

Comments

@AuthorProxy
Copy link

AuthorProxy commented May 24, 2021

Do you have sample how to use useStateValidator with latest typescript, sample from the docs and story book doesn't work now

@AuthorProxy
Copy link
Author

looks like because TS have type:

interface ValidityState {
    readonly badInput: boolean;
    readonly customError: boolean;
    readonly patternMismatch: boolean;
    readonly rangeOverflow: boolean;
    readonly rangeUnderflow: boolean;
    readonly stepMismatch: boolean;
    readonly tooLong: boolean;
    readonly tooShort: boolean;
    readonly typeMismatch: boolean;
    readonly valid: boolean;
    readonly valueMissing: boolean;
}

@JoeDuncko
Copy link

Hi! @react-hookz/web, the new library by one of react-use's former maintainers (background here and here) has a new implementation of useValidator that has examples in Typescript. Maybe it can help.

For those interested, there's an official migration guide for migrating from react-use to @react-hookz/web.

Hope this helps!

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

2 participants