anchor.diff:                 ""
          end,
          "\n",
  -       format_export_types(get_type_specs_by_opts(Opts),
  -                           get_records_or_maps_by_opts(Opts), Defs),
  +       format_export_types(Defs, Opts),
          "\n",
          [[?f("~s~n", [format_load_nif(Mod, Opts)]),
            "\n"]
  
positive.code:                    [FieldTxt2, LineUpStr2, FNum,
                      [", " || TypeComment /= ""], TypeComment]);
             ({I, #gpb_oneof{name=Name}=Field}) ->
                  TypeStr = ?f("~s", [type_to_typestr(Field, Defs, CompileOpts)]),
                  CommaSep = if I < length(Fields) -> ",";
                                true               -> "" %% last entry
                             end,
                  FieldTxt1 = indent(Indent, ?f("~w", [Name])),
                  FieldTxt2 = if TypeSpecs ->
                                      LineUp = lineup(iolist_size(FieldTxt1), 32),
                                      ?f("~s~s~s ~s~s", [FieldTxt1, LineUp,
  
negative.code: % --- exported types -----------------------------------------------------
  format_enum_typespec(Enum, Enumeration) ->
    ?f("-type '~s'() :: ~s.", [Enum,
      string:join(["'"++atom_to_list(EName)++"'" || {EName, _} <- Enumeration],
                  " | ")]).
  
  
  format_record_typespec(Msg, Fields, Defs, Opts) ->
      case get_records_or_maps_by_opts(Opts) of
          records ->
              ?f("-type ~p() :: #~p{}.", [Msg, Msg]);
          maps ->
              ?f("-type ~p() ::~n"
                 "      #{~s~n"
                 "       }.",
                 [Msg, outdent_first(format_hfields(7 + 1, Fields, Opts, Defs))])
      end.
  
  format_export_types(Defs, Opts) ->
      case get_type_specs_by_opts(Opts) of
          false ->
              "";
          true ->
              iolist_to_binary(
                ["%% enumerate types\n",
                 string:join([format_enum_typespec(Enum, Enumeration)
                              || {{enum, Enum}, Enumeration} <- Defs],
                             "\n"),
                 "\n",
                 ?f("-export_type([~s]).",
                    [string:join(["'"++atom_to_list(Enum)++"'/0"
                                  || {{enum, Enum}, _} <- Defs], ", ")]),
                 "\n\n",
                 "%% message types\n",
                 string:join([format_record_typespec(Msg, Fields, Defs, Opts)
                              || {{msg, Msg}, Fields} <- Defs],
                             "\n"),
                 "\n",
                 ?f("-export_type([~s]).",
                    [string:join(["'"++atom_to_list(Msg)++"'/0"
                                  || {{msg, Msg}, _} <- Defs], ", ")]),
                 "\n"])
      end.
  
  %% -- hrl -----------------------------------------------------
  
  