Bernhard
02/28/2025, 11:08 AMbroadway_lamb
02/28/2025, 11:15 AMEdoardo Luppi
02/28/2025, 11:18 AM@JsPlainObject
for that.
https://github.com/JetBrains/kotlin-wrappers/blob/master/kotlin-js/src/jsMain/kotlin/js/array/JsTuple.ktBernhard
02/28/2025, 11:28 AM@JsPlainObject
external interface WhenPredicate {
val `when`: JsTuple2<Predicate, String>
}
Bernhard
02/28/2025, 11:29 AMEdoardo Luppi
02/28/2025, 11:32 AMJsTuple2
you'd end up with something like
val wp = WhenPredicate(tupleOf(..., "something"))
Bernhard
02/28/2025, 11:32 AMBernhard
02/28/2025, 11:33 AMBernhard
02/28/2025, 11:33 AMEdoardo Luppi
02/28/2025, 11:35 AM{
"when": [
{
"eq": [
1,
2
]
},
"2"
]
}
Would translate to exactly what you posted in KotlinBernhard
02/28/2025, 11:36 AMEdoardo Luppi
02/28/2025, 11:36 AMval (p, s) = whenPredicate.when
Bernhard
02/28/2025, 11:37 AMEdoardo Luppi
02/28/2025, 11:39 AMBernhard
02/28/2025, 11:40 AMEdoardo Luppi
02/28/2025, 11:42 AMexternal
part, so in your case external + JPO annotation is the way to go, as you're indeed importing an external library and you don't want a real JS class
to end up in your bundle.