Function enumValues

  • Decorates a property with enum validation

    Type Parameters

    • T extends string | number

    Parameters

    • values: readonly T[]

      Array of valid enum values

    Returns PropertyDecorator

    class User {
    @enumValues(['admin', 'user', 'guest'])
    role: string;
    }