Hello. How can I get KType of a nullable variable?
# announcements
g
Hello. How can I get KType of a nullable variable?
c
nullableSomething?.let { it::class.createType() }
g
I want to know the defined type even if the value is null
c
`null`'s type is
Nothing?
You cannot infer variable's type from its value if the value is
null
. Maybe you'll be able to do something when/if this gets implemented: https://youtrack.jetbrains.com/issue/KT-16303