andylamax
02/09/2022, 11:31 AMclass UserService {
fun createUser(
name: String, tag: String = name
) = "User(name=$name,tag=$tag)"
}
This breaks the compiler and no output can be generated
Expected Behavior
This should work the same as it does in Kotlin/JVM and Kotlin/Native, or without @JsExport
Workaround
• Avoid using @JsExport
This problem appears to happen only when you mark interfaces and classes with @JsExport
, so if you can, avoid using @JsExport
• Use nullables instead
class UserService {
fun createUser(
name: String, tag: String? = null
) = "User(name=$name,tag=${tag ?: name})"
}
Apprently, this has already been reported here. So give an up vote please