Checks if an object has a property with the specified key.

This utility function verifies whether an object has a property with the specified key. It allows choosing between checking in the entire prototype chain or only the object's own properties.

  • Type Parameters

    • T

    Parameters

    • obj: T

      The object to check for the property.

    • key: keyof T

      The key to check for in the object.

    • mode: PropertyCheckMode = PropertyCheckMode.PrototypeChain

      The mode specifying whether to check own properties only or include the prototype chain.

    Returns obj is T

    true if the object has the property based on the chosen method, otherwise false.