devtypes - v1.1.0
    Preparing search index...

    Type Alias HasProperty<T, K>

    HasProperty: K extends keyof T ? true : false

    Test if an object has a specific property.

    Type Parameters

    • T

      The object type

    • K extends PropertyKey

      The property key to check

    1.1.0

    Distinguishes between properties that are missing vs. undefined. Useful for generic type checks in mapped or conditional types.

    type Obj = { a: string; b?: number };
    type Has_a = HasProperty< Obj, 'a' >; // true
    type Has_c = HasProperty< Obj, 'c' >; // false