named-child-schema-type
Reference a named Zod record child's complete schema type instead of repeating its explicit annotation.
Why
Repeating a child schema's generic contract creates a second maintained declaration even though the record already uses that child at runtime.
Fix
Replace only the matching record type argument with typeof ChildSchema, or share one explicit named schema type alias between child and record to retain an independently named public contract. Keep the outer annotation required by isolatedDeclarations and every runtime schema operation.
Examples
import { z } from "zod";const KeySchema: z.ZodEnum<{ a: "a"; b: "b" }> = z.enum(["a", "b"]);export const RecordSchema: z.ZodRecord< z.ZodEnum<{ a: "a"; b: "b" }>, z.ZodString> = z.record(KeySchema, z.string());import { z } from "zod";const KeySchema: z.ZodEnum<{ a: "a"; b: "b" }> = z.enum(["a", "b"]);export const RecordSchema: z.ZodRecord<typeof KeySchema, z.ZodString> = z.record( KeySchema, z.string(),);