It Should Help

Objects Verifier Reference

Created by should().objects<T extends {}, P extends {}>(entry: T, other: P) — both objects are required up front. The modifier methods configure the comparison; equal() runs it.

Methods

Method

Role

equal()

runs the deep comparison (inverted by a preceding not)

rule<K>(prop: K, checker: (o1: T[K], o2: T[K]) => boolean)

custom equality for one property; repeatable

map<K, L>(name1: K, name2: L)

compare property name1 of the first object against name2 of the second

ignoring(...props)

exclude properties from the comparison

compareOnly(...props)

exclusive whitelist of properties; overrides ignoring

Order matters: modifiers first, equal() last. Plus the inherited not and defined().

Comparison semantics

  • Property counts of the two sides must match (after map renames and exclusions).

  • Nested objects are compared recursively; nested object values without a rule fall back to reference equality; Date properties compare by string representation.

  • A failing rule reports Objects failed custom rule for '<field>'.

Representative messages

  • The objects has different number of properties.

  • Objects have different '<path>': <val1> & <val2>. — the path includes nesting (user.address.city).

Guide: Objects.

02 сентября 2026