def _generate_union(self, union_type):
union_name = fmt_type_name(union_type)<EOL>self._emit_jsdoc_header(union_type.doc)<EOL>self.emit('<STR_LIT>' % union_name)<EOL>variant_types = []<EOL>for variant in union_type.all_fields:<EOL><INDENT>variant_types.append("<STR_LIT>" % variant.name)<EOL>variant_data_type, _, _ = unwrap(variant.data_type)<EOL>if not is_void_type(variant_data_type):<EOL><INDENT>variant_doc = '<STR_LIT>' % variant.name<EOL>if variant.doc:<EOL><INDENT>variant_doc += '<STR_LIT:U+0020>' + variant.doc<EOL><DEDENT>self.emit_wrapped_text(<EOL>'<STR_LIT>' % (<EOL>fmt_type(variant_data_type),<EOL>variant.name,<EOL>variant_doc,<EOL>),<EOL>prefix='<STR_LIT>',<EOL>)<EOL><DEDENT><DEDENT>jsdoc_tag_union = fmt_jsdoc_union(variant_types)<EOL>self.emit('<STR_LIT>' % jsdoc_tag_union)<EOL>self.emit('<STR_LIT>')<EOL>
Emits a JSDoc @typedef for a union type.