diff --git a/express-zod-api/src/mapping-helpers.ts b/express-zod-api/src/mapping-helpers.ts deleted file mode 100644 index ea193eba6d..0000000000 --- a/express-zod-api/src/mapping-helpers.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @fileoverview Mapping utils for Zod Runtime Plugin (remap) - * @link https://stackoverflow.com/questions/55454125/typescript-remapping-object-properties-in-typesafe - */ -type TuplesFromObject = { - [P in keyof T]: [P, T[P]]; -}[keyof T]; - -type GetKeyByValue = - TuplesFromObject extends infer TT - ? TT extends [infer P, V] - ? P - : never - : never; - -export type Remap = { - [P in NonNullable]: T[GetKeyByValue]; -}; - -export type Intact = { [K in Exclude]: T[K] }; diff --git a/express-zod-api/src/zod-plugin.ts b/express-zod-api/src/zod-plugin.ts index 9ffbea63f3..737130d5a8 100644 --- a/express-zod-api/src/zod-plugin.ts +++ b/express-zod-api/src/zod-plugin.ts @@ -10,7 +10,6 @@ import * as R from "ramda"; import { z } from "zod/v4"; import { getExamples, metaSymbol } from "./metadata"; -import { Intact, Remap } from "./mapping-helpers"; import type { $ZodType, $ZodShape, @@ -39,6 +38,8 @@ declare module "zod/v4/core" { } } +export type Intact = { [K in Exclude]: T[K] }; + declare module "zod/v4" { interface ZodType< out Output = unknown, @@ -68,7 +69,7 @@ declare module "zod/v4" { mapping: U, ): z.ZodPipe< z.ZodPipe, // internal type simplified - z.ZodObject & Intact, Config> + z.ZodObject & Intact, Config> >; remap( mapper: (subject: Shape) => U,