Skip to content

TypeScript - Examples of using unknown types? #425

@ryanmunger

Description

@ryanmunger

Are there any examples of how to use types properly using the unknown type? Struggling with getting informed v4 set up in my project.

Specifically some advice on how to type useField/useState stuff so it's not unknown:

const { fieldState, fieldApi } = useField<string, string>(props);

is what i tried, it (the compiler) accepts that line, but using fieldState.value returns an unknown type which doesn't play well with other types.

Thank you in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions