code: def gen_def(anno: swagger_parser.TypeDef) -> Code:
      code = IndentedLines()
      if isinstance(anno, swagger_parser.Class):
          clean_description = (anno.description or "").replace(
              "\n", " "
          )
          proper_name = upper_first(anno.name)
  
          code.start_comment()
          code += f"{clean_description}"
          code += "@export"
          code += f"@interface {proper_name}"
          code.end_comment()
  
          code += f"export interface {proper_name} {{"
          code.indent()
          for _, param in anno.params.items():
              clean_title = (param.title or "").replace("\n", " ")
              required_txt = ":" if param.required else "?:"
              param_annotation = annotation(param.type)
              code.start_comment()
              code += f"{clean_title}"
              code += f"@type {{{param_annotation}}}"
              code += f"@memberof {proper_name}"
              code.end_comment()
              code += f"{param.name}{required_txt} {param_annotation};"
          code.dedent()
          code += "}"
          return str(code)
      if isinstance(anno, swagger_parser.Enum):
          clean_description = (anno.description or "").replace(
              "\n", " "
          )
          proper_name = anno.name[0].upper() + anno.name[1:]
  
          code.start_comment()
          code += clean_description
          code += "@export"
          code += (
              "@enum {string}"  # parser assumes all enums are strings
          )
          code.end_comment()
  
          code += f"export const {proper_name} = {{"
          code.indent()
          # can't find where this logic exists in the old codegen -- aargh
          prefix = (
              longest_common_prefix(anno.members)
              if len(anno.members) > 1
              else ""
          )
          for member in anno.members:
              clean_member_name = member[len(prefix) :].replace("_", "")
              code += f"{clean_member_name}: '{member}',"
          code.dedent()
          code += "} as const"
  
          code += f"export type {proper_name} = ValueOf<typeof {proper_name}>"
          return str(code)
      assert_never(anno)
  
imports: import os
  import re
  import typing
  from dataclasses import dataclass, field
  from shutil import copy, rmtree
  import swagger_parser
  from typing_extensions import Literal, assert_never
label_desc: Use image node_id 6 for calling a global function with example usage: gen_def(anno) and returns: str, str