• Checks if the given value is a Map without duplicates with regard to the given projection.

    // Ensure the map does not include duplicate users.
    @MapUnique<User>(user => user.id)
    usersByEmail: Map<string, User>

    Type Parameters

    • Value = unknown

      The type of the map's values.

    • Projection = Value

      The type returned by projection.

    Parameters

    • projection: ((item: Value) => Projection)

      The function mapping each map entry to the value that is used for the uniqueness check.

    • Optionaloptions: ValidationOptions

      Generic class-validator options.

    Returns PropertyDecorator