Add Zod Validation

1.0.4Last update Jan 10, 2025
by@Codemod

This codemod adds zod validation to query parsing.

Example

Before

const query = buildQuery(props.location?.search ?? "");
const someParam = query?.["some-param"] === "true";

After

import { z } from "zod";
const querySchema = z.object({
"some-param": z.string(),
});
const query = buildQuery(props.location?.search ?? "");
const parsedQuery = querySchema.parse(query);
const someParam = parsedQuery["some-param"] === "true";

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now