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

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

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

    • Optionaloptions: ValidationOptions

      Generic class-validator options.

    Returns PropertyDecorator