Home > types-kit > OptionalKeys
Get optional property keys of T.
Signature:
export type OptionalKeys<T> = {
[K in keyof T]-?: {} extends Pick<T, K> ? K : never
}[Keys<T>]References: Keys
interface Props {
a?: number
readonly b: number
c?: number
}
// Expect: 'a' | 'c'
type PropKeys = OptionalKeys<Props>