Provide extension unsafeCast for dynamic.

#KT-15310
This commit is contained in:
Ilya Gorbunov
2016-12-20 23:36:40 +03:00
parent c43e4f6682
commit b2a4c27709
3 changed files with 26 additions and 0 deletions
+7
View File
@@ -23,6 +23,13 @@ public inline fun Any?.asDynamic(): dynamic = this
*/
public inline fun <T> Any?.unsafeCast(): @kotlin.internal.NoInfer T = this.asDynamic()
/**
* Reinterprets this `dynamic` value as a value of the specified type [T] without any actual type checking.
*/
@kotlin.internal.DynamicExtension
@JsName("unsafeCastDynamic")
public inline fun <T> dynamic.unsafeCast(): @kotlin.internal.NoInfer T = this
// TODO add the support ES6 iterators
@kotlin.internal.DynamicExtension
public operator fun dynamic.iterator(): Iterator<dynamic> {