Is it possible to get the KType of a nested sealed...
# reflect
j
Is it possible to get the KType of a nested sealed class? All I have access to is
T
and I know
T
is a
Sealed Class
.
d
A
KType
represents more than a class, it represents a class and its type arguments (
List
is a class,
List<String>
or
List<out T>
is a KType). If you want a KType you can use
KClass.createType
(https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect.full/create-type.html). This requires you to specify the type arguments.
👍 1