type RequiredKeys<T> = {
[K in keyof T]-?: undefined extends T[K] ? never : K
}[keyof T]
// Extracts only the required (non-optional) keys from TMapped types with -? remove optionality, enabling you to compute which keys are required.
Challenge: Implement hasAllKeys<T extends object>(obj: unknown, keys: (keyof T)[]): obj is T β a type guard checking that obj has all specified keys.
hasAllKeys<{a:number}>(obj, ['a']) // β true if obj.a exists