@pengzhanbo/utils - v3.5.0
    Preparing search index...

    Type Alias OptionalKeys<T>

    OptionalKeys: { [K in keyof T]-?: undefined extends T[K] ? K : never }[keyof T]

    Extracts the keys of T that are optional

    提取 T 中可选的键

    Type Parameters

    • T extends object
    interface Person {
    name: string
    age?: number
    address: string
    }
    type Keys = OptionalKeys<Person>
    // 'age'