Skip to content

Commit

Permalink
Fix walker for non-proprietary brands.
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTail committed May 9, 2024
1 parent 59a0d3f commit 5453ff9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/schema-walker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ export const walkSchema = <U extends object, Context extends FlatObject = {}>({
rules: HandlingRules<U, Context>;
onMissing: SchemaHandler<z.ZodTypeAny, U, Context, "last">;
}): 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 });
Expand Down

0 comments on commit 5453ff9

Please sign in to comment.