import { Constructor } from '../../types/Constructor'; import { IMappingKey } from '../../types/MappingKey'; /** * Type constraint to ensure mapping compatibility. * Checks that all required keys in TDestination exist in TSource. * * @internal */ type MappingCompatible = { [K in keyof TDestination]: K extends keyof TSource ? TSource[K] extends TDestination[K] | null | undefined ? TDestination[K] : TDestination[K] : TDestination[K]; }; /** * Defines the interface for a mapping builder. * * @public */ export interface IMappingBuilder { /** * Creates a mapping between two types. * Ensures compile-time type compatibility between source and destination. * * @public * @param source - The source type. * @param destination - The destination type. * @param fn - The mapping function that must return a valid destination. */ createMap(source: Constructor, destination: Constructor, fn: (source: TSource) => MappingCompatible & TDestination): this; /** * Creates a keyed mapping between two types with full type safety. * The mapping key encodes both input and output types at compile time. * * @public * @param key - The type-safe mapping key. * @param fn - The mapping function that must return a valid destination. */ createKeyedMap(key: IMappingKey, fn: (source: TInput) => MappingCompatible & TOutput): this; } export {};