diff --git a/kotlin-extensions/src/main/kotlin/kotlinext/js/Object.kt b/kotlin-extensions/src/main/kotlin/kotlinext/js/Object.kt index d8910b8b60503..cf31f80b68bd3 100644 --- a/kotlin-extensions/src/main/kotlin/kotlinext/js/Object.kt +++ b/kotlin-extensions/src/main/kotlin/kotlinext/js/Object.kt @@ -17,7 +17,7 @@ external interface JsObject { fun propertyIsEnumerable(v: String): Boolean } -fun Any.asJsObject() = this as JsObject +fun Any.asJsObject() = unsafeCast() external object Object { fun getPrototypeOf(o: T): P? diff --git a/kotlin-react/src/main/kotlin/react/RBuilder.kt b/kotlin-react/src/main/kotlin/react/RBuilder.kt index 5f9ff8036f75e..7961ce70e34fc 100644 --- a/kotlin-react/src/main/kotlin/react/RBuilder.kt +++ b/kotlin-react/src/main/kotlin/react/RBuilder.kt @@ -85,8 +85,10 @@ fun buildElements(handler: RBuilder.() -> Unit): dynamic { open class RBuilderSingle : RBuilder() -inline fun buildElement(handler: RBuilder.() -> Unit): ReactElement? = - RBuilder().apply(handler).childList.first() as ReactElement? +inline fun buildElement(handler: RBuilder.() -> Unit): ReactElement = + RBuilder().apply(handler) + .childList.first() + .unsafeCast() open class RElementBuilder(open val attrs: P) : RBuilder() { fun attrs(handler: P.() -> Unit) {