With alias you can give a type a different name:

alias PInt32 = Pointer(Int32)

ptr = PInt32.malloc(1) # : Pointer(Int32)

Every time you use an alias the compiler replaces it with the type it refers to.

Aliases are useful to avoid writing long type names, but also to be able to talk about recursive types:

Baseball Players Shoes Trainer Black 2 MIZD9 Red Men's Mizuno Turf alias RecArray = Array(Int32) | Array(RecArray)

ary = [] of RecArray
ary.push [Players Baseball Red 2 Black Mizuno Turf Men's MIZD9 Shoes Trainer 1, 2, 3]
ary.push ary
ary #=> [[1, 2, 3], [...]]Calvin Monk Sloan Men's Loafer Black Strap Calf Dress Klein rqUra7

A real-world example of a recursive type is json:

module Json
  alias Type = Nil |
               Bool |
               Int64 |
               Float64 |
               String |
               Array(Type) |
               Hash(String, Type)
end