Skip to content

Commit cbda99a

Browse files
committed
docs(canvas): justify deliberate cross-type cast in BarcodeObject
1 parent 7970295 commit cbda99a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎src/components/Canvas/BarcodeObject.tsx‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,13 @@ export function BarcodeObject({
175175
!ObjectRegistry[obj.type]?.interpretationLocked &&
176176
!!(obj.props as { printInterpretation?: boolean }).printInterpretation;
177177
const printInterp = isUpright && printInterpEnabled;
178+
// Cross-type access: this block runs for every barcode and reads moduleWidth
179+
// generically (textFontSize is computed for HRI text rendering downstream).
180+
// Unlike buildBwipOptions, this function isn't switch-structured by obj.type,
181+
// so per-case narrowing would require restructuring the whole block. The
182+
// cast + fallback stays as the documented boundary between cross-type code
183+
// and the per-type required-typed schemas (2D types without moduleWidth fall
184+
// through with the default; their branches don't render HRI text anyway).
178185
const moduleWidth =
179186
(obj.props as { moduleWidth?: number }).moduleWidth ?? 2;
180187
const textFontSize = Math.max(dotsToPx(moduleWidth * 10, scale, dpmm), 6);

0 commit comments

Comments
 (0)