• Narrows an unknown value to an object if it is type-compatible, or raises an error otherwise.

    Type Parameters

    • T extends object = object

    Parameters

    • value: unknown

      The value to test.

    • Optionalmessage: string

      The error message to use if value is not type-compatible.

    Returns asserts value is T

    AssertionFailedError If the value was undefined.