Writing Type Specifications
Learn how to use typespecs and dialyxir to identify possible bugs in the code.
We'll cover the following
What are typespecs?
While Elixir isn’t a statically typed language, it does give the ability to specify types using typespecifications, or typespecs. Typespecs are specifications that communicate the intended use of a function.
For example, a function add/2
that adds two numbers a
and b
might have the following specification:
Get hands-on with 1400+ tech skills courses.