Hello, What is the alternative to @JsExport a fun...
# multiplatform
a
Hello, What is the alternative to @JsExport a function with a [Mutable]Map<String, String>? I'm getting a Exported declaration uses non-exportable parameter type: Map<String, String> error on functions that have Map as parameters. Thanks
a
Thanks! The only problem with Pair is that it doesn't store a set of data. Just one Pair. I would have to create my own Map using a combination of Array and Pair somehow.
Actually, I see your point with using json. Let me look into this.
a
@ankushg Tried using the kotlin-wrappers, but it doesn't seem like Gradle is loading them. In fact, it seems to break my code. Can I use this in a multiplatform project? Do I put the dependencies in the common code or in the JS target? Thanks
a
Ah I've copied the definition of
Record
into my
jsMain
sourceset, and then (in my
jsMain
sourceset) wrap my
Map
-using method in one that converts to/from
Record
a
I see. So this is really for JavaScript to Kotlin interoperability. I'm actually building a MPP that targets the JVM and JS. So I need it in my common code.
a
Yeah it's definitely painful — we have a ton of common code using maps and data classes for JVM and Native, and then need to wrap everything for JS :-/
a
@ankushg question: do you know why when I use @file:JsExport on a class that extends another, the overridden methods don't get exported?