Hi, I'm trying to use LinkedHashMap from JavaScri...
# multiplatform
a
Hi, I'm trying to use LinkedHashMap from JavaScript (Typescript, really) and I have the following in my code...
Copy code
const kotlin = require("kotlin");

...

let identityContext = new kotlin.kotlin.collections.LinkedHashMap()        
identityContext.put("mYKey","myValue");
but when I run this, I get the following error: TypeError: identityContext.put is not a function When I look at kotlin.js, I see the following definition of "put":
Copy code
LinkedHashMap.prototype.put_xwzc9p$ = function (key, value)
I see that LinkedHashMap is an expect class, so I assumed that there's a JavaScript accept class with proper @JsName declarations. Is this not the case? Do I need to use the mangled function name? Thanks
c
If you're in IDEA, you can navigate to the LinkedHashMap declaration (right click, navigate to, type declaration), then from there navigate to the actual definition (right click, navigate to, actual)
Not sure if that will help you much though, I don't have a computer on hand
a
Thanks, let me try that. Usually, for expect classes, there's an icon on the gutter to navigate to the actual, but it's not there when I go to the definition. But I'll try your suggestion.
c
Are you able to use
put
for other List implementations?
a
Haven't tried, but I suspect I'm going to hit the same issue.