Can anyone help me with defining the type ExcludeAllRequiredProps<T>
in the code below to exclude all required properties? Any assistance would be greatly appreciated. Thank you.
type A = {
a: number,
b: number,
c?: number,
d?: number
}
type B = ExcludeAllRequiredProps<A>
// Expected result for B is { c?: number, d?: number }
[Update - later on]
What are your thoughts on this proposed solution?
type ExcludeAllRequiredProps<T> = {
[K in keyof T]?: T extends Record<K, T[K]> ? never : T[K]
}