[K/JS] Prepare JS Plain Objects plugin to publication

This commit is contained in:
Artem Kobzar
2024-01-17 10:52:58 +00:00
committed by Space Team
parent 561be747c1
commit dfe2d8651e
53 changed files with 479 additions and 393 deletions
@@ -0,0 +1,21 @@
package foo
import kotlinx.js.JsPlainObject
@JsPlainObject
external interface User {
var name: String
val age: Int
}
fun box(): String {
val user = User(name = "Name", age = 10)
if (user.name != "Name") return "Fail: problem with `name` property"
if (user.age != 10) return "Fail: problem with `age` property"
val json = js("JSON.stringify(user)")
if (json != "{\"age\":10,\"name\":\"Name\"}") return "Fail: got the next json: $json"
return "OK"
}