Skip to content

itz.Either Alias With Arrays #5

@zeluisping

Description

@zeluisping

Is your feature request related to a problem? Please describe.
Having to write itz.Either(...) every time I have a union type is very annoying.

Describe the solution you'd like
Simply use arrays of validators as an alias to itz.Either, it looks way cleaner.

Describe alternatives you've considered
There really isn't a simpler alternative than this.

Additional context

Before

const foo = itz.A({
    foo: itz.Either(itz.String, itz.AsNumber, itz.Undefined),
});

After

const foo = itz.A({
    foo: [itz.String, itz.AsNumber, itz.Undefined],
});

This together with #4 would allow for cleaner structure definitions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions