I'm translating Java code into TypeScript and I've come across something I can't understand.
I've create here object literal name a and I manage to use it as associative array.
Then I've define class Node and create variable name n, when I try to use the variable n as key to the associative array the tsc compiler fail with Illegal property access.
If I convert n variable to kk variable of type any everything works.
Why is that?
var a = {}
a['a'] = 3
a[4] = 5
class Node {
}
var n:Node = new Node();
a[n] = 44; <---- Illegal property access
var kk: any = n;
a[kk] = 55