[KT-59294] [wasm] Resolve undefined to null for any nullable types in external functions

This commit is contained in:
Shagen Ogandzhanian
2023-07-18 13:06:33 +02:00
committed by teamcity
parent ef6dcd9779
commit eb7805baf9
3 changed files with 9 additions and 9 deletions
@@ -25,6 +25,10 @@ fun getNull(): EI? =
fun getUndefined(): EI? =
js("undefined")
// https://youtrack.jetbrains.com/issue/KT-59294/WASM-localStorage-Cannot-read-properties-of-undefined-reading-length
fun getStringUndefined(): String? =
js("undefined")
fun isJsNull(ref: EI?): Boolean =
js("ref === null")
@@ -55,6 +59,7 @@ fun box(): String {
assertTrue((jsNull as Any?) == null)
assertTrue((jsNull as Any?) === null)
assertTrue(jsUndefined == null)
assertTrue(getStringUndefined() == null)
assertTrue(isJsNull(null))
assertTrue(isJsNull(null as EI?))