//#region src/utils/types.d.ts /** * Maps all properties of a type to boolean flags. * Useful for feature flags, capability indicators, or boolean option sets. * * @template T - The type whose properties are mapped to booleans. * @example type Features = BooleanProps<{health: any; armor: any}>; // => {health: boolean, armor: boolean} */ type BooleanProps = { [Property in keyof T]: boolean }; /** * Removes readonly modifiers from all properties, making them mutable. * One level of immutability removal (see MutableDeep for recursive removal). * * @template T - The type to make mutable. * @example type Mut = Mutable<{readonly x: number}>; // => {x: number} */ type Mutable = { -readonly [K in keyof T]: T[K] }; /** * Recursively removes readonly modifiers from all properties at all nesting levels. * Makes entire object graph mutable. * * @template T - The type to make mutable recursively. */ type MutableDeep = { -readonly [K in keyof T]: Mutable }; type ImmutablePrimitive = undefined | null | boolean | string | number | Function; /** * Makes a type fully immutable at the top level only. * Primitives and functions remain unchanged. * Collections (Array, Map, Set) become readonly. * Objects have their properties made readonly. * * @template T - The type to make immutable. * @example type Imm = Immutable<{x: number}>; // => {readonly x: number} */ type Immutable = T extends ImmutablePrimitive ? T : T extends Array ? ImmutableArray : T extends Map ? ImmutableMap : T extends Set ? ImmutableSet : ImmutableObject; /** * Readonly array variant for use in Immutable type transformation. * * @template T - Element type of the array. */ type ImmutableArray = ReadonlyArray>; /** * Readonly map variant for use in Immutable type transformation. * * @template K - Key type of the map. * @template V - Value type of the map. */ type ImmutableMap = ReadonlyMap, Immutable>; /** * Readonly set variant for use in Immutable type transformation. * * @template T - Element type of the set. */ type ImmutableSet = ReadonlySet>; /** * Makes all object properties readonly (one level only). * * @template T - The type to make immutable. */ type ImmutableObject = { readonly [K in keyof T]: T[K] }; /** * Recursively makes all properties readonly at all nesting levels. * Provides complete immutability guarantee for the entire object graph. * * @template T - The type to make deeply immutable. */ type ImmutableObjectDeep = { readonly [K in keyof T]: Immutable }; /** * Recursively makes all properties optional at all nesting levels. */ type DeepPartial = T extends ((...args: unknown[]) => unknown) ? T : T extends readonly unknown[] ? T : T extends object ? { [K in keyof T]?: DeepPartial } : T; //#endregion export { ImmutableMap as a, ImmutableSet as c, ImmutableArray as i, Mutable as l, DeepPartial as n, ImmutableObject as o, Immutable as r, ImmutableObjectDeep as s, BooleanProps as t, MutableDeep as u }; //# sourceMappingURL=types-Bbmnq4ni.d.cts.map