[JS] Support wrapped and dynamic types in typeOf

This commit is contained in:
Svyatoslav Kuzmich
2019-09-30 18:10:41 +03:00
parent 030aaee117
commit 5d7f18b1b9
6 changed files with 32 additions and 10 deletions
@@ -19,6 +19,9 @@ internal fun createKType(
) =
KTypeImpl(classifier, arguments.asList(), isMarkedNullable)
@JsName("createDynamicKType")
internal fun createDynamicKType(): KType = DynamicKType
@JsName("markKTypeNullable")
internal fun markKTypeNullable(kType: KType) = KTypeImpl(kType.classifier!!, kType.arguments, true)
@@ -45,6 +45,14 @@ internal class KTypeImpl(
}
}
internal object DynamicKType : KType {
override val classifier: KClassifier? = null
override val arguments: List<KTypeProjection> = emptyList()
override val isMarkedNullable: Boolean = false
override val annotations: List<Annotation> = emptyList()
override fun toString(): String = "dynamic"
}
internal fun KVariance.prefixString() =
when (this) {
KVariance.INVARIANT -> ""