langchain.js
    Preparing search index...
    InferNodeNames: T extends { "~NodeType": infer N }
        ? N extends string ? Exclude<N, "__start__"> : string
        : string

    Infer the node names from a compiled graph.

    Extracts the ~NodeType phantom property from CompiledGraph instances, providing a union of all node names defined in the graph.

    Type Parameters

    • T
    const graph = new StateGraph(StateAnnotation)
    .addNode("agent", agentFn)
    .addNode("tool", toolFn)
    .compile();

    type NodeNames = InferNodeNames<typeof graph>; // "agent" | "tool"