elixirtypespec

How to disable doc generating for type definitions in Elixir?


For example I have a module like

defmodule Foo do
  @type bar :: string
end

But I don't want to generate doc for bar because it's meant to use internal implementation.


Solution

  • There's @typedoc for types like @doc for functions, but unlike @doc false, @typedoc false doesn't seem to hide the type from the documentation. Since this is for internal use, I'm assuming you don't want to export it out of the module either, so you can use @typep to declare it private, which will also remove it from the documentation:

    defmodule Foo do
      @typep bar :: string
    end