• P.union(...patterns) returns a pattern which matches if at least one of the patterns provided in parameter match the input.

    Read the documentation for P.union on GitHub

    Type Parameters

    Parameters

    Returns Chainable<OrP<input, patterns>>

    Example

    match(value)
    .with(
    { type: P.union('a', 'b', 'c') },
    ({ type }) => 'will match { type: "a" | "b" | "c" }'
    )