fix: omit fontSize on silkscreentext when font_size is null#31
Open
gsdali wants to merge 1 commit intotscircuit:mainfrom
Open
fix: omit fontSize on silkscreentext when font_size is null#31gsdali wants to merge 1 commit intotscircuit:mainfrom
gsdali wants to merge 1 commit intotscircuit:mainfrom
Conversation
pcb_silkscreen_text elements parsed from kicad_mod files often
lack a font_size (when the source omits the (effects (font (size
N N))) clause). The generator was emitting fontSize={null} in
that case, producing TSX that fails downstream typecheck because
SilkscreenTextProps.fontSize rejects null/undefined.
Fix: build the silkscreentext attribute list conditionally — only
include fontSize= when stext.font_size != null. When omitted,
the renderer's default applies.
Add a regression test (test4b) demonstrating that a silkscreen text
without font_size produces TSX that contains neither
fontSize={null} nor fontSize={undefined}.
Hit while running `tsci convert` on a 157-pad LGA kicad_mod —
every output file required hand-removing fontSize={null} from a
single line before it would typecheck.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pcb_silkscreen_textelements parsed from kicad_mod files often lack afont_sizefield (when the source omits the(effects (font (size N N)))clause). The generator was emittingfontSize={null}in that case, producing TSX that fails downstream typecheck becauseSilkscreenTextProps.fontSizerejects null/undefined.Fix
Build the
<silkscreentext>attribute list conditionally — only includefontSize=whenstext.font_size != null. When omitted, the renderer's default applies. Behavior whenfont_sizeIS set is unchanged (existing test4 snapshot still matches).Repro / motivation
Hit while running
tsci converton a 157-pad LGA InsightSiPkicad_modfrom a community KiCad library. Every output file required hand-removingfontSize={null}from a single line before it would typecheck — same fix every time.Test plan
fontSize={null}orfontSize={undefined}in output ✓bun test: 16 / 16 passbun run format:check: clean🤖 Generated with Claude Code