isShallowEqual()function

isShallowEqual(left: unknown, right: T): left is T
ParamType
leftunknown
The value to check and narrow. required
rightT
The value to compare against. required
Return
left is T
true if the values are shallowly equal.

Are two unknown values shallowly equal?

  • If the values are both arrays/objects, see if the items/properties are shallowly equal with each other.

Examples

isShallowEqual({ a: 1 }, { a: 1 }) // true