Interface CustomType<T>

The CustomType interface is the base interface for all custom types in the SDK. It provides methods for comparing, converting, and cloning objects.

interface CustomType<T> {
    clone(): T;
    convert<U>(convertFunction?: ((val: NumberType) => U)): CustomType<any>;
    equals<U>(other: undefined | null | CustomType<U>, normalizeNumberTypes?: boolean): boolean;
    getNumberFieldNames(): string[];
    hasNumberFields(): boolean;
    toJson(): JsonObject;
    toJsonString(): string;
}

Type Parameters

Implemented by

Methods

  • Compares this object's fields to another object's fields for equality. Equality is determined by comparing the JSON representations of the objects.

    If normalizeNumberTypes is true, then all number types will be compared as strings (i.e. "1n" === "1" === 1). Else, they will be compared as their native types (i.e. 1n !== 1 !== "1").

    Type Parameters

    Parameters

    • other: undefined | null | CustomType<U>
    • OptionalnormalizeNumberTypes: boolean

    Returns boolean

  • Internal helper method to convert the number fields of the object to a different NumberType equivalent.

    Returns string[]

  • Checks if the object has number fields.

    Returns boolean

  • Converts the object to a JSON object with all primitive types.

    Returns JsonObject

  • Converts the object to a JSON string.

    Returns string