Hi, is there a kmp example project with JS target ...
# multiplatform
m
Hi, is there a kmp example project with JS target using classes with kotlinx.datetime types as properties like Instant which are exported to a TS definition using js-joda? (I‘m new to kmp)
a
Hi, Mira. Unfortunately, if the library (like kotlinx.datetime) didn't mark its types with a special @JsExport annotation, those types would not be visible in TS definitions. We consider the problem and try to find a solution for such an issue.
m
Thanks, Artem! Is there a workaround for this issue? Something to configure manually?
a
You can write a wrapper for the class you are interested in. Imagine there is a class
Foo
which is not exported from a third-party library. You can write something like this:
Copy code
package my.own.project

import third.party.library.Foo as LibraryFoo

@JsExport
class Foo(private val foo: LibraryFoo) {
 ...
}
And work with such a class in your project. So, your service which returns
Foo
will be available from JS to interact with all the methods inside
Foo
m
Thanks, will try that 👌🏼
kodee happy 1