The @spec says the function is returning an opaque type, but it is returning a different type.
defmodule Types do @opaque type :: :ok end defmodule Example do @spec ok() :: Types.type() def ok() do :ok end end