You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I have a pretty simple example to demonstrate my problem:
export interfaceShape{name: string;}consthashMap=newMap<[Shape,Shape],number>();constshape1={name:"A"};constshape2={name:"B"};hashMap.set([shape1,shape2],0);console.log(hashMap.has([shape1,shape2]));// returns false from some reason
So in this example, I have a Map that uses tuple of Shapes as a key.
And it returns false since when using [shape1, shape2] twice, it creates two different arrays in terms of address so the has method probably makes a shallow comparison between them, and as a result, returns false.
I thought maybe I could override has method to fits my needs? to shallow comparison Shape1 and Shape2 instead of the whole array.