Skip to main content

render_type

Function render_type 

Source
pub fn render_type(ty: &Type, config: &EmitConfig) -> Result<String, EmitError>
Expand description

Render one Rust type as TypeScript, with no type pool and no surrounding declaration.

This is the same classifier emit uses for struct fields and enum payloads — smart-pointer peeling, container generics, primitives, and the external-types table — exposed for callers that hold a single type rather than a pool of declarations. User-defined types render as their terminal ident, exactly as they do inside a declaration; resolving that ident to a definition is the caller’s business.

ontogen’s API-signature emitter (rust_type_to_ts) delegates here, which is what keeps the two TypeScript emitters from disagreeing on a shape they both have to render into the same generated file.