From 5453ff99b430d2597254c93ca675000ee521c330 Mon Sep 17 00:00:00 2001 From: Robin Tail Date: Sun, 5 May 2024 14:38:15 +0200 Subject: [PATCH] Fix walker for non-proprietary brands. --- src/schema-walker.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/schema-walker.ts b/src/schema-walker.ts index fa03df348..00aa0846f 100644 --- a/src/schema-walker.ts +++ b/src/schema-walker.ts @@ -47,8 +47,9 @@ export const walkSchema = ({ rules: HandlingRules; onMissing: SchemaHandler; }): U => { - const kind = getMeta(schema, "brand") || schema._def.typeName; - const handler = kind ? rules[kind as keyof typeof rules] : undefined; + const handler = + rules[getMeta(schema, "brand") as keyof typeof rules] || + rules[schema._def.typeName as keyof typeof rules]; const ctx = rest as unknown as Context; const next = (subject: z.ZodTypeAny) => walkSchema({ schema: subject, ...ctx, onEach, rules, onMissing });