Defining New Types

Understand how to define new types in Elixir.

We'll cover the following

The attribute @type can be used to define new types as follows:

@type type_name :: type_specification.

Examples

Elixir uses this to predefine some built-in types and aliases. Here are just some of them:

Get hands-on with 1200+ tech skills courses.