[Wasm] Add JsAny.unsafeCast

Replacement for Dynamic.unsafeCast, but limited to JsAny types where
it makes sense.
This commit is contained in:
Svyatoslav Kuzmich
2023-03-20 17:29:29 +01:00
committed by Space Team
parent e32611d2f2
commit cafc27aae9
+13 -1
View File
@@ -5,7 +5,19 @@
package kotlin.js
import kotlin.wasm.internal.ExcludedFromCodegen
import kotlin.wasm.internal.WasmNoOpCast
import kotlin.wasm.internal.implementedAsIntrinsic
/**
* Any JavaScript value except null or undefined
*/
public external interface JsAny
public external interface JsAny
/**
* Cast JsAny to other Js type without runtime check
*/
@WasmNoOpCast
@ExcludedFromCodegen
public fun <T : JsAny> JsAny.unsafeCast(): T =
implementedAsIntrinsic