rune-langium / core/src / serializeElement
Function: serializeElement()
ts
function serializeElement(element): string;Defined in: packages/core/src/serializer/rosetta-serializer.ts:355
Serialize a single AST element (Data, Choice, or RosettaEnumeration) to text.
Parameters
| Parameter | Type | Description |
|---|---|---|
element | unknown | A duck-typed AST element with a $type discriminant. |
Returns
string
.rosetta text for the element, or "" for unsupported element types.
Remarks
Returns an empty string for unsupported element types (RosettaFunction, RosettaRule, etc.) — callers should check the returned string length if element type membership is uncertain.
Use When
- Generating a snippet for one type definition without a full namespace header
- Preview rendering a single type in editor UI