Function assertClass

  • Cast an object to a type. Check the type at runtime.

    Returns

    item

    Throws

    If the item is not of the correct type, throw an Error with a detailed message.

    Type Parameters

    • T extends object

    Parameters

    • item: unknown

      Check the type of this item.

    • ty: (new () => T)

      The expected type. This should be a class.

        • new (): T
        • Returns T

    • notes: string = "Assertion Failed."

      This will be included in the error message.

    Returns T

Generated using TypeDoc