https://kotlinlang.org logo
#javascript
Title
# javascript
d

Distractic

11/07/2023, 8:12 PM
Hello Is this possible to import a Kotlin multiplatform library directly through NPM for a 100% Javascript project ? If yes, what are the conditions for the library ?
b

benkuly

11/08/2023, 12:34 PM
Possible, yes https://kotlinlang.org/docs/js-to-kotlin-interop.html But very limited (for example
StateFlow
s cannot be exported).
c

CLOVIS

11/09/2023, 4:40 PM
> If yes, what are the conditions for the library ? Only symbols (classes, functions…) annotated with
@JsExport
are visible to JS code. You can learn more about the restrictions for that here: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.js/-js-export/ For those, the Kotlin compiler can also generate TS definition files (
*.d.ts
) so you can have auto-complete and type checks in your IDE.
4 Views