collectype / types/utility / Optional
Optional<
T> ={ [P in keyof T as undefined extends T[P] ? P : never]: T[P] }
Defined in: types/utility.ts:53
Selects keys from type T whose value type includes undefined.
T
The object type to inspect.
type Example = Optional<{ a: number; b?: string; c: undefined }>;
// Result: { b?: string; c: undefined }