import { Prettify } from "./prettify"; /** * Make passed properties in the passed argument readonly * @example * ```ts * // { readonly a: string, b: number } * type T0 = ReadonlyOnly<{ a: string, b: number }, 'a'>; * ``` */ export type ReadonlyOnly = Prettify< Pick> & { readonly [P in K]: T[P]; } >; /** * Make all properties in the passed argument readonly except for the passed properties * @example * ```ts * // { a: string, readonly b: number } * type T0 = ReadonlyExcept<{ a: string, b: number }, 'a'>; * ``` */ export type ReadonlyExcept = Prettify< Pick & { readonly [P in Exclude]: T[P]; } >;