Because of type erasure, generic type info isn’t available at runtime. `reified` in an `inline` function keeps the type at the call site, so you can do things like `T::class` or `value is T` safely.
inline fun <reified T> Any?.asTypeOrNull(): T? = this as? T
val x: Any = 123
val n: Int? = x.asTypeOrNull<Int>()