Let the following type alias
class Container[T]
type MyInt = Container[Int]
Is it possible and how to declare a type parameter in a type alias, having tried
type MyInt2 = Container[T <: Int] // error: ']' expected but '<:' found.
You can do:
type MyInt2[T <: Int] = Container[T]
As for other members (e.g. def
), type member must declare type parameter in its declaration/signature (left), not in the body (right).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With