chromium/mojo/public/tools/bindings/generators/js_templates/lite/union_definition.tmpl

{%  if generate_closure_exports -%}
goog.provide('{{module.namespace}}.{{union.name}}');
{% endif %}

mojo.internal.Union(
    {{module.namespace}}.{{union.name}}Spec.$, '{{union.name}}',
    {
{%- for field in union.fields %}
      '{{field.name}}': {
        'ordinal': {{field.ordinal}},
        'type': {{field.kind|lite_js_type}},
{%-    if field.kind.is_nullable %}
        'nullable': true,
{%-    endif %}
      },
{%- endfor %}
    });

/**
 * @typedef { {
{%- for field in union.fields %}
 *   {{field.name}}: ({{field.kind|lite_closure_type_with_nullability}}|undefined),
{%-  endfor %}
 * } }
 */
{{module.namespace}}.{{union.name}};