Skip to content

Sum type / oneOfType #321

Description

@rivertam

Hi there. Sorry if this is already included, but I can't find any documentation or issues regarding it.

I'm looking for a way to validate that a given type is one of multiple possible types. In FP, it would look like number | string, for example. React PropTypes offers this as oneOfType. I think yup would probably have either oneOfType or .or as in .string().or(yup.number()).

Is anything like this supported?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions