I am trying to make a typealias of a generic type class as follows
class Cars {
...
}
typealias SportCars = Cars
but I am getting a
I think the farthest you can go with typealias
and generics is to create an alias of a specialized type, such as:
typealias SportsCar = Cars
If you need a different name for the same generic type, you can just subclass it:
class SportCars : Cars {}
it's not exactly an alias (you cannot use Cars
when SportCars
is expected, but the opposite is possible), but in a "controlled" environment it can work. I wouldn't use myself though.