The @spec, while not incorrect, is more general than the type returned by the function.
defmodule Example do @spec ok() :: any def ok() do :ok end end