NodeId: {
    builtInPrefix: "built-in:";
    fromBuiltIn<T extends string>(this: void, id: `built-in:${T}`): T;
    isBuiltIn(
        this: void,
        id: undefined | `built-in:${string}` | NodeId<string | number>,
    ): id is `built-in:${string}`;
    name: "NodeId";
    normalize(this: void, id: NodeId): NodeId;
    toBuiltIn<T extends string>(this: void, name: T): `built-in:${T}`;
}

The type of the id assigned to each node. Branded to avoid problematic usages with other string or numeric types. The default ids are numeric, but we use a branded type to avoid confusion with other numeric types. Custom ids or scoped ids can be strings, but they will be normalized to numbers if they are numeric strings.

Type declaration

  • ReadonlybuiltInPrefix: "built-in:"

    The prefix used for built-in function or operator ids.

  • fromBuiltIn:function
    • Recovers the built-in function or operator name from a built-in id by removing the built-in prefix.

      Type Parameters

      • T extends string

      Parameters

      • this: void
      • id: `built-in:${T}`

      Returns T

      • isBuiltIn - to check if a given node id is a built-in function or operator id
      • toBuiltIn - to convert a built-in function or operator name to a built-in id
  • isBuiltIn:function
    • Checks if a given node id is a built-in function or operator id by checking if it is a string that starts with the built-in prefix.

      Parameters

      • this: void
      • id: undefined | `built-in:${string}` | NodeId<string | number>

      Returns id is `built-in:${string}`

      • toBuiltIn - to convert a built-in function or operator name to a built-in id
      • fromBuiltIn - to recover the built-in function or operator name from a built-in id
  • Readonlyname: "NodeId"
  • normalize:function
  • toBuiltIn:function
    • Converts a built-in function or operator name to a built-in id by prefixing it with the built-in prefix.

      Type Parameters

      • T extends string

      Parameters

      • this: void
      • name: T

      Returns `built-in:${T}`

      • isBuiltIn - to check if a given node id is a built-in function or operator id
      • fromBuiltIn - to recover the built-in function or operator name from a built-in id