andylamax
04/22/2023, 7:08 AM@JsExports
and also have a wasm target.
e.g.
commonMain/kotlin/sample/User.kt
package sample
import kotlin.js.JsExport
@JsExport
class User
fails with
> Task compileKotlinWasm FAILED
e: sample/src/commonMain/kotlin/sample/User.kt This annotation is not applicable to target 'class'
If I move the annotation up, to file level, like so
@file:JsExport
@file:JsExport
package koncurrent
import kotlin.js.JsExport
class User
fails with
> Task compileKotlinWasm FAILED
e: sample/src/commonMain/kotlin/sample/User.kt This annotation is not applicable to target 'file' and use site target '@file'
Any known workarround?? Some supressions perhaps??andylamax
04/22/2023, 7:08 AMSuppress
king that I know about. Any help?Svyatoslav Kuzmich [JB]
04/22/2023, 2:32 PM// common:
expect annotation class JsTargetOnlyJsExport()
@JsTargetOnlyJsExport
class User
// js:
actual typealias JsTargetOnlyJsExport = JsExport // Real JsExport
// wasm:
actual annotation class JsTargetOnlyJsExport // Fake JsExport, does nothing
Alternatively you can use experimental @OptionalExpectation on JsTargetOnlyJsExport to avoid defining fake actuals in non-JS platforms.andylamax
04/22/2023, 5:05 PMJSTargetOnlyJsExport
would be tremendous.
If fixing this won't take that much time, I can definitely waitSvyatoslav Kuzmich [JB]
04/22/2023, 6:31 PM@Suppress("WRONG_ANNOTATION_TARGET")
would take about the same effort, but it would be a lot more hacky.andylamax
04/22/2023, 7:00 PMandylamax
07/29/2023, 1:35 AM@JsExport
on common main. Is there a ticket I can follow up with?andylamax
10/05/2023, 8:54 AMSvyatoslav Kuzmich [JB]
10/05/2023, 10:12 AMandylamax
10/06/2023, 2:38 AM