Sometimes, we need to use a complex type in several places. Rather than keep repeating the function type or the complex generic setup, we can use a type alias to provide a "shorthand" way to reference the type.
Setting up a type alias is a matter of using the typealias
keyword,
followed by your desired name, =
, and the type to be represented by that
name.
Then, elsewhere in your code, you can use the alias' name instead of the type itself.
You can learn more about this in:
Tags: