jaqxues
10/15/2020, 8:09 PMudalov
jaqxues
10/16/2020, 8:56 AMfun <T: Any> withType(type: KClass<T>)
and fun <T> withType(type: KType)
To
inline fun <reified T>()
Something like
if (isGeneric<T>) typeOf<T>() else T::class
Also when the type is nullable, use a KType ig. For that null is T
would work though I think.udalov
val type = typeOf<T>()
if (type.isMarkedNullable || type.arguments.isNotEmpty()) type else T::class
jaqxues
10/16/2020, 9:46 AM