From 5285fb582347fd8694e73dd52e100eb2eedb2e05 Mon Sep 17 00:00:00 2001 From: Manish Chaudhary Date: Fri, 8 May 2026 03:18:22 +0530 Subject: [PATCH 1/2] Move resistor footprint mapping onto the footprint field --- lib/components/resistor.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/components/resistor.ts b/lib/components/resistor.ts index 65f13b0..8ba54d7 100644 --- a/lib/components/resistor.ts +++ b/lib/components/resistor.ts @@ -5,6 +5,7 @@ import { commonComponentProps, lrPins, } from "lib/common/layout" +import { footprintProp } from "lib/common/footprintProp" import { schematicSymbolSize, type SchematicSymbolSize, @@ -56,8 +57,9 @@ const mapResistorFootprint = ( if (!resistorImperialFootprintNames.has(footprint)) return footprint return `res${footprint}` } -export const resistorProps = commonComponentProps +export const resistorProps: z.ZodType = commonComponentProps .extend({ + footprint: footprintProp.optional().transform(mapResistorFootprint), resistance, tolerance: z .union([z.string(), z.number()]) @@ -89,10 +91,6 @@ export const resistorProps = commonComponentProps connections: createConnectionsProp(resistorPinLabels).optional(), }) - .transform((props) => ({ - ...props, - footprint: mapResistorFootprint(props.footprint), - })) export const resistorPins = lrPins type InferredResistorProps = z.input From f6466e52c2b544a93fb8a201084a8afc3e46c2bb Mon Sep 17 00:00:00 2001 From: Manish Chaudhary Date: Fri, 8 May 2026 03:20:00 +0530 Subject: [PATCH 2/2] Update resistor.ts --- lib/components/resistor.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/components/resistor.ts b/lib/components/resistor.ts index 8ba54d7..704b03c 100644 --- a/lib/components/resistor.ts +++ b/lib/components/resistor.ts @@ -57,8 +57,8 @@ const mapResistorFootprint = ( if (!resistorImperialFootprintNames.has(footprint)) return footprint return `res${footprint}` } -export const resistorProps: z.ZodType = commonComponentProps - .extend({ +export const resistorProps: z.ZodType = + commonComponentProps.extend({ footprint: footprintProp.optional().transform(mapResistorFootprint), resistance, tolerance: z