fn emit_struct_interface(out: &mut String, s: &StructDef, schema: &ParsedSchema)Expand description
Emit a TypeScript interface from a struct definition.
Union-having structs emit as typed discriminated-union aliases (see
super::emits_union_alias): each arm mirrors exactly what the generated
parser returns for that discriminant ({ variant: '<name>', data: <typed> },
with any non-union fields shared into every arm), plus the parser’s
default-case { variant: 'unknown'; data: null }. Mixed structs (named
fields + union) that are referenced data types must take this path — a
named-fields-only interface would not declare the variant/data
properties the generated request serializer switches on (#1616).
Service/scoped envelopes and plain structs get a named-fields interface.