export type ExtractPartial = Partial[K]; export type ExtractRequired = Required[K]; /** Void function. */ export type Fn = () => void; /** Something may be an array. */ export type MaybeArray = T | T[]; /** Something may be a promise. */ export type MaybePromise = T | PromiseLike; /** Something may be a readonly array. */ export type MaybeReadonlyArray = T | readonly T[]; /** Null or undefined. */ export type nil = null | undefined; /** Something may be nullish. */ export type Option = T | nil; /** Constructs a type where all properties of `T` may be null. */ export type PartialNull = { [P in keyof T]: T[P] | null; }; /** Constructs a type where all properties of `T` may be nullish. */ export type PartialNullish = { [P in keyof T]?: Option; }; /** Like `Pick`, but constructs the type based on the values. */ export type PickByValue = { [P in keyof T as T[P] extends V ? P : never]: T[P]; }; /** Constructs a type by picking the set of properties `K` from a partial version of `T`. */ export type PickPartial = Pick, K>; /** Constructs a type by picking the set of properties `K` from a required version of `T`. */ export type PickRequired = Pick, K>; /** Constructs a type where all properties of `T` may be written. */ export type Writable = { -readonly [P in keyof T]: T[P]; }; /** Constructs a type where all properties of `T` may be written and nullish. */ export type WritablePartial = Writable>; /** Constructs a type consisting of some properties of T set to partial. */ export type WithPartial = Omit & Partial>; export type WithPartialNullish = Omit & PartialNullish>; /** Constructs a type consisting of some properties of T set to required. */ export type WithRequired = Omit & Required>;