Skip to content

Union between 2 pipelines returns strange error #1210

Closed
@YassienW

Description

@YassienW

I'm trying to create a field that accepts either an ip address or a url,

const Schema = object({
  address: union([
    pipe(string(), trim(), minLength(1, "Address is required"), ip()),
    pipe(string(), trim(), minLength(1, "Address is required"), url()),
  ]),
});

when validating i get a strange error:

Uncaught ValiError: Invalid type: Expected string but received "test"

You can see this live here

Metadata

Metadata

Assignees

Labels

intendedThe behavior is expectedquestionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions