rune-langium / visual-editor/src / AstNodeModel
Type Alias: AstNodeModel<T>
ts
type AstNodeModel<T> = {
$type: T["$type"];
} & { -readonly [K in Exclude<keyof T, ExcludedFields | "$type">]: SerializeField<T[K]> };Defined in: packages/visual-editor/src/types.ts:106
Mapped type that plucks and recursively serializes fields from any Langium AST node type.
$type is preserved as a readonly literal (derived from the generic parameter) for runtime discrimination. All other fields are made mutable for editing.
Type Declaration
| Name | Type | Defined in |
|---|---|---|
$type | T["$type"] | packages/visual-editor/src/types.ts:107 |
Type Parameters
| Type Parameter |
|---|
T extends AstNodeShape |
Example
ts
// AstNodeModel<Data> yields:
// {
// readonly $type: 'Data';
// name: string;
// definition?: string;
// superType?: Reference<DataOrChoice>;
// attributes: AstNodeModel<Attribute>[];
// conditions: AstNodeModel<Condition>[];
// annotations: AstNodeModel<AnnotationRef>[];
// synonyms: AstNodeModel<RosettaClassSynonym>[];
// }