Open alexlohe25 opened 2 years ago
I have this same problem since upgrading fast-equals from version 3.0.2
to 4.0.1
, looks like there have been some changes in the createCustomEqual
function.
EDIT: for anyone who uses this code in their maps implementation: pinning fast-equals to ~3.0.3
should fix this.
For 4.0.1
version I've replaced function deepCompareEqualsForMaps
with following code:
import {createCustomEqual, deepEqual} from "fast-equals";
const deepCompareEqualsForMaps = createCustomEqual(() => ({
areObjectsEqual: (a, b) => {
if (isLatLngLiteral(a) || a instanceof google.maps.LatLng || isLatLngLiteral(b) || b instanceof google.maps.LatLng) {
return new google.maps.LatLng(a).equals(new google.maps.LatLng(b));
}
return deepEqual(a, b);
},
}));
Inner arrow function may be extracted to separate function. See fast-equals
recipe.
Nevertheless, I haven't dig into this comparison library, so I'm not sure about returning deepEquals()
for other objects. Maybe there can be used something more accurate.
Operating system
Windows 10 21H2
Browser Version
Firefox 102.0
How severe is the bug?
high
Bug description
Checking the custom hook for deep comparisons, the method createCustomEqual in deepCompareEqualsForMaps (line 213, in react-maps/docs/index.tsx), does not recognize both a and b:
(deepEqual) => (a: any, b: any)
throws the following error:
And also the
deepEqual(a , b);
call throws the error:I guess both things are related to some Typescript error using fast-equals library. I also tried cloning the repository and the same problems are still showing up.
Steps to reproduce
No response
Console log output
No response