@roomy-chat/sdk
    Preparing search index...

    Function getType

    • Get the type of a value that may be a container.

      Example

      const doc = new LoroDoc();
      const map = doc.getMap("map");
      const list = doc.getList("list");
      const text = doc.getText("text");
      getType(map); // "Map"
      getType(list); // "List"
      getType(text); // "Text"
      getType(123); // "Json"
      getType("123"); // "Json"
      getType({}); // "Json"

      Type Parameters

      • T

      Parameters

      • value: T

      Returns T extends LoroText
          ? "Text"
          : T extends LoroMap<any>
              ? "Map"
              : T extends LoroTree<any>
                  ? "Tree"
                  : T extends LoroList<any>
                      ? "List"
                      : T extends LoroCounter ? "Counter" : "Json"