Fix equalOwnProperties

equalOwnProperties would incorrectly report two map-like objects as equal in
the case where a property defined in `left` was not defined in `right` and
whose value was considered "equal" to undefined by the equalityComparer.

This bug was found by an alert on LGTM.com
This commit is contained in:
Sam Lanning 2018-08-30 14:08:24 -07:00
parent 65fa0128bb
commit 2c41d8b44e

View File

@ -1272,7 +1272,7 @@ namespace ts {
if (!left || !right) return false;
for (const key in left) {
if (hasOwnProperty.call(left, key)) {
if (!hasOwnProperty.call(right, key) === undefined) return false;
if (!hasOwnProperty.call(right, key)) return false;
if (!equalityComparer(left[key], right[key])) return false;
}
}