Hi, How to get reified type parameter nested? I me...
# announcements
i
Hi, How to get reified type parameter nested? I means
inline fun <reified T: Any> awsl()
If I use it as:
awsl<List<String>>()
How to get the
String
from
T
? Thank you
e
Looks like you can use
typeOf<T>()
as of Kotlin 1.3.50 according to this StackOverflow answer: https://stackoverflow.com/a/36253311
You’ll get a
KType
from that function, then you can use
KType.arguments
to get the parametrized type arguments of the type
i
Thank you. I will have a look
k
Is T always a
List
?