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

    Example

    // 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) => Projection)

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

    • Optional options: ValidationOptions

      Generic class-validator options.

    Returns PropertyDecorator