Interface WeakSet<T>

A Set object with its __mode metamethod set to "k"

interface WeakSet<T> {
    add(this, value): this;
    clear(this): void;
    delete(this, value): boolean;
    forEach(this, callbackfn): void;
    has(this, value): boolean;
    isEmpty(this): boolean;
    size(this): number;
}

Type Parameters

  • T extends object

Hierarchy

  • Set<T>
    • WeakSet

Methods

  • Adds a value to the set

    Parameters

    • this: Set<T>
    • value: T

    Returns this

  • Deletes all members of the set.

    Parameters

    • this: Set<T>

    Returns void

  • Deletes the given key from the set.

    Returns a boolean indicating whether or not a value was removed.

    Parameters

    • this: Set<T>
    • value: T

    Returns boolean

  • Performs the specified action for each (element / pair of elements) in the set

    Parameters

    • this: ReadonlySet<T>
    • callbackfn: ((value, value2, self) => void)

      A function that accepts up to three arguments. forEach calls the callbackfn function one time for each (element / pair of elements) in the array.

        • (value, value2, self): void
        • Parameters

          • value: T
          • value2: T
          • self: ReadonlySet<T>

          Returns void

    Returns void

  • Returns a boolean for whether the given key exists in the set

    Parameters

    • this: ReadonlySet<T>
    • value: T

    Returns boolean

  • Returns true if empty, otherwise false.

    Parameters

    • this: ReadonlySet<T>

    Returns boolean

  • Returns the number of elements in the set

    Parameters

    • this: ReadonlySet<T>

    Returns number