An interface implemented by objects with custom comparison logic. Used in conjunction with BY_COMPARE_TO.

interface Comparable<T> {
    compareTo(other: T): number;
}

Type Parameters

  • T

Methods

Methods

  • Compares this to other. Returns < 0 if this < other, > 0 if this > other and 0 if this == other.

    Parameters

    • other: T

    Returns number