chromium/mojo/public/tools/bindings/generators/ts_templates/enum_definition.tmpl

{%- macro enum_def(enum) -%}
export const {{enum|ts_type}}Spec: { $: mojo.internal.MojomType } = { $: mojo.internal.Enum() };

export enum {{enum|ts_type}} {
{# MIN_VALUE and MAX_VALUE need to be first to ensure that the reverse mapping will be correct. #}
{%- if enum.min_value is not none %}
  MIN_VALUE = {{enum.min_value}},
{%- endif %}
{%- if enum.max_value is not none %}
  MAX_VALUE = {{enum.max_value}},
{%- endif %}
{%- for field in enum.fields %}
  {{field.name}} = {{field.numeric_value}},
{%- endfor %}
}

{%- endmacro %}