Function enumeration

  • a schema that accepts a limited set of strings

    Type Parameters

    • const V extends readonly [string, string]

    Parameters

    • Rest ...values: V

    Returns CompiledSchema<V[number], {
        enum: [...V];
    }>

    Remarks

    enum is a reserved word in typescript, so this is called enumeration.

    Example

    const schema = enumeration("a", "b", "c");
    schema.guard("a");