Hi guys :wave: I'm having trouble with the new typ...
# javascript
k
Hi guys 👋 I'm having trouble with the new typescript definition export from Kotlin in 1.4-M1 😓 (1) Adding @ JsExport outside jsMain source directory in multiplatform Gradle project does not work*? So this means that one cannot export type definitions for types that are shared between platform targets? (2) When creating a regular kotlin/js project in IntelliJ, I cannot find a way to activate the new IR back-end compiler and the definition export - I assume this is not supported? Typescript definition export would simplify my current project dramatically, so I keep hoping it would be possible to get at least one of these options working? 🤞 Edit : the IR backend is activated in the gradle.properties file.
k
Hi, thanks for the reply 🙂 I have already activated the IR backend. Again, the problem is that I cannot add @JsExport to classes outside the javascript platform specific classes, but there it works.
t
You need
1.4-M2
🙂 (in progress) Now you can use 1.4-M2-eap-76 for testing
k
I'll try that 🙂 Thanks @turansky
K 2
b
(Copy from reddit) Hi! 1. It was fixed in the upcoming 1.4-M2 (KT-35966), stay tuned! In 1.4-M1 you can work around it by defining expected annotation in common:
expect annotation class CommonJsExport()
And actualize it in js sorceset using a typealias:
actual typealias CommonJsExport = JsExport
So, now you can use 
CommonJsExport
 to export declarations. 2. In a Gradle project (since 1.4-M1) defining property 
kotlin.js.compiler=ir
 in 
gradle.properties
 should be enough, please file an issue and attach a project if it doesn’t work for you.
a regular kotlin/js project in IntelliJ
Do you mean IntelliJ projects w/o using any external build system, like Gradle? That’s right -- now we provide a switch only inside Gradle projects. And we recommend using Gradle for new projects.
🎖️ 2
k
Thank you very much for the workaround, it compiles now 🙂 Appreciate it! Looking forward to M2, and let me say again that adding typescript definitions really improved the ergonomics, so this is a great feature you're cooking up.