Dictionary not working
Closed this issue · 1 comments
davidmoshal commented
Hi, looks like you dictionary isn't working:
var dict = new collections.Dictionary<{x:number},string>();
console.log(dict.getValue({x:2}));
dict.setValue({x:1}, 'x=1');
console.log(dict.getValue({x:2}));
I created a dictionary with a key: {x:number}
- Looking for the value for {x:2} returns undefined, which is correct.
- Then I setValue for key {x:1} to 'x=1'.
- Now, when I look for the value associated with key {x:2} I get 'x=1' - Incorrect, there should still be no value with key of {x:2}
basarat commented
key: {x:number}
You need to provide a toString
implementation: https://github.com/basarat/typescript-collections#a-note-on-equality