collectype

collectype v0.11.0


collectype / types/utility / Optional

Type Alias: Optional<T>

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.

Type Parameters

T

T

The object type to inspect.

Example

type Example = Optional<{ a: number; b?: string; c: undefined }>;
// Result: { b?: string; c: undefined }