{%- if !imports.is_empty() %}
{%- for import in imports %}
import { {{ import.name }} } from '{{ import.path }}';
{%- endfor %}

{%- endif %}
{%- if doc != "" %}
/**
 * {{ doc }}
 */
{%- endif %}
export type {{ name }} =
{%- for variant in variants %}
{%- match variant %}
{%- when TsUnionVariantTemplate::Unit with (name) %}
  | { {{ tag_field }}: "{{ name }}" }
{%- when TsUnionVariantTemplate::Newtype with { name, type_str } %}
  | { {{ tag_field }}: "{{ name }}"; {{ content_field }}: {{ type_str|safe }} }
{%- endmatch %}
{%- endfor %};
