import { Prettify } from "./prettify"; /** * Make all properties in the passed argument non-nullable * @example * ```ts * // { a: string, b: number } * type T0 = NonNullableObject<{ a: string | null, b: number | undefined }>; * ``` */ export type NonNullableObject = { [K in keyof T]: NonNullable; }; /** * Make passed properties in the passed argument non-nullable * @example * ```ts * // { a: string, b: number, c: boolean | null } * type T0 = NonNullableObjectOnly<{ a: string | null, b: number | undefined, c: boolean | null }, "a" | "b">; * ``` */ export type NonNullableObjectOnly = Prettify< Pick> & { [P in K]: NonNullable; } >; /** * Make all properties in the passed argument non-nullable except for the passed properties * @example * ```ts * // { a: string, b: number, c: boolean | null } * type T0 = NonNullableObjectExcept<{ a: string | null, b: number | undefined, c: boolean | null }, "c">; * ``` */ export type NonNullableObjectExcept = Prettify< Pick & { [P in Exclude]: NonNullable; } >;