Skip to content

rune-langium / visual-editor/src / resolveNodeKind

Function: resolveNodeKind() ​

ts
function resolveNodeKind(nodeOrData): string;

Defined in: packages/visual-editor/src/adapters/model-helpers.ts:267

Resolve the React-Flow node-kind ('data' | 'choice' | 'enum' | ...) for a node or its data payload.

Accepts either a React-Flow node ({ data }) or the inner data payload directly, and resolves via data.$type alone. $type is guaranteed on every node since the typeKind→$type unification (Phase 2 curated-serializer fix), so the former node.type fallback arm is retired. Unrecognised or $type-less inputs degrade to the 'data' last-resort default.

Use this helper instead of indexing AST_TYPE_TO_NODE_TYPE directly.

Parameters ​

ParameterType
nodeOrDataunknown

Returns ​

string

Core packages released under MIT. Studio app released under FSL-1.1-ALv2.