• Checks if the given value is a Map whose keys are all unique with regard to the given projection.

    Example

    // Ensure there are no duplicate user ids in the map.
    @MapUniqueKeys<User>(user => user.id)
    postsByUser: Map<User, Post[]>

    Type Parameters

    • Key = unknown

      The type of the map's keys.

    • Projection = unknown

      The type returned by projection.

    Parameters

    • projection: ((item) => Projection)

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

    • Optional options: ValidationOptions

      Generic class-validator options.

    Returns PropertyDecorator