/** * @public * * Transforms any members of the object T having type FromType * to ToType. This applies only to exact type matches. * * This is for the case where FromType is a union and only those fields * matching the same union should be transformed. */ export type Transform = ConditionalRecursiveTransformExact; /** * @internal * * Returns ToType if T matches exactly with FromType. */ type TransformExact = [T] extends [FromType] ? ([FromType] extends [T] ? ToType : T) : T; /** * @internal * * Applies TransformExact to members of an object recursively. */ type RecursiveTransformExact = T extends Function ? T : T extends object ? { [key in keyof T]: [T[key]] extends [FromType] ? [FromType] extends [T[key]] ? ToType : ConditionalRecursiveTransformExact : ConditionalRecursiveTransformExact; } : TransformExact; /** * @internal * * Same as RecursiveTransformExact but does not assign to an object * unless there is a matching transformed member. */ type ConditionalRecursiveTransformExact = [T] extends [ RecursiveTransformExact ] ? [RecursiveTransformExact] extends [T] ? T : RecursiveTransformExact : RecursiveTransformExact; export {};