Hello, when I declare a typealias, am I supposed t...
# announcements
a
Hello, when I declare a typealias, am I supposed to be able to discriminate between the alias and the aliased type in a when expression?
a
adolev: There is no way to determine whether its the typealias or the type itself. if you have a
typealias UserName = String
, you can pass a
String
when a method expects a
Username
"Type aliases do not introduce new types. They are equivalent to the corresponding underlying types." says the doc
a
OK, thanks! I was just wondering, if it was the case, how the type information was retained at runtime. This makes it a lot simpler 🙂