I noticed you can define a type alias with default...
# multiplatform
m
I noticed you can define a type alias with default generics, such as
typealias MyCoolMap = HashMap<String, Any>
in Kotlin but when using Kotlin Multiplatform you can't do an
expect/actual
using a similar approach. For example:
expect class MyCoolMap
and
actual typealias MyCoolMap = HashMap<String, Any>
would not compile. The other way (define generics that are not used in a platform) also don't work. My use case is that I have a type that has generics in one platform but not in all platforms - in a few we could just fallback to
Any
but Kotlin does not allow us to typealises it. API compatibility is a deal breaker, so I can't wrap the type either. I'm wondering if anyone knows why that is not allowed? Any technical limitations or is it just a design decision?