type-plus
    Preparing search index...

    Type Alias IsOptionalKey<T, K, Then, Else>

    IsOptionalKey: K extends OptionalKeys<T> ? Then : Else

    Validate if the key K in T is optional.

    🎭 predicate

    Type Parameters

    • T
    • K
    • Then = true
    • Else = false
    IsOptionalKey({ a: 1 }, 'a') // false
    IsOptionalKey({ a?: 1 }, 'a') // true