Skip to content

Commit a3f7fff

Browse files
committed
Using typed R.renameKeys, 0.31.0.
1 parent e875b3c commit a3f7fff

3 files changed

Lines changed: 15 additions & 22 deletions

File tree

express-zod-api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"@types/express-fileupload": "catalog:dev",
9595
"@types/http-errors": "catalog:dev",
9696
"@types/node-forge": "^1.3.11",
97-
"@types/ramda": "^0.30.0",
97+
"@types/ramda": "^0.31.0",
9898
"@types/semver": "^7.7.0",
9999
"camelize-ts": "^3.0.0",
100100
"compression": "catalog:dev",

express-zod-api/src/zod-plugin.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ import type {
2828
$strip,
2929
} from "zod/v4/core";
3030

31-
/** @todo remove when typed, https://github.com/ramda/types/pull/140 */
32-
declare module "ramda" {
33-
function renameKeys<
34-
V extends string,
35-
T extends object,
36-
U extends { [P in keyof T]?: V },
37-
>(mapping: U): (subject: T) => Remap<T, U, V>;
38-
}
39-
4031
declare module "zod/v4/core" {
4132
interface GlobalMeta {
4233
default?: unknown; // can be an actual value or a label like "Today"
@@ -132,11 +123,13 @@ const brandSetter = function (
132123
return this.check(new $EZBrandCheck({ brand, check: "$EZBrandCheck" }));
133124
};
134125

126+
type _Mapper = <T extends Record<string, unknown>>(
127+
subject: T,
128+
) => { [P in string | keyof T]: T[keyof T] };
129+
135130
const objectMapper = function (
136131
this: z.ZodObject,
137-
tool:
138-
| Record<string, string>
139-
| (<T>(subject: T) => { [P in string | keyof T]: T[keyof T] }),
132+
tool: Record<string, string> | _Mapper,
140133
) {
141134
const transformer =
142135
typeof tool === "function" ? tool : R.renameKeys(R.reject(R.isNil, tool)); // rejecting undefined

pnpm-lock.yaml

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)