Does Kotlin have type aliases?


#1

I've read about type aliases in Kotlin in an older blog post, but I can not find any current information about it. So is it possible to define type aliases like in Scala?

Example:

scala> class Something[A, B]
defined class Something


scala> type X = Something[String, Int]
defined type alias X


scala> val x = new X
x: Something[String,Int] = Something@50378a4

Christian


#2

Type aliases are not supported, unlikely to be added in the nearest future.


#3

I’m writing tests in Kotlin/Spek against plain Java/Javaslang code and trying to figure out a better way to use Javaslang persistent collections from Kotlin so type aliases would be great. Since Kotlin is very Java friendly, this feature could improve Java interop a lot.


#4

I came here from a google search, and I just want to quickly mention that Kotlin does now support type aliases! See the official docs for more information.