Skip to content

fix(pad): default w/h to 1mm so the bare name renders like smtpad - #902

Open
Furox-Art wants to merge 1 commit into
tscircuit:mainfrom
Furox-Art:fix/pad-bare-name-defaults
Open

Furox-Art wants to merge 1 commit into
tscircuit:mainfrom
Furox-Art:fix/pad-bare-name-defaults

Conversation

@Furox-Art

Copy link
Copy Markdown

Fixes #788

Summary

pad is advertised by getFootprintNames(), but fp.string("pad") crashed with a raw TypeError: undefined is not an object (evaluating 'n.replace') leaking @tscircuit/mm internals: pad_def declared w/h with no defaults and pad() read them straight off the params without parsing.

Changes

  • pad_def: give w and h a 1mm default, matching the sibling smtpad behavior (else width = mm("1mm"))
  • pad(): parse params through pad_def so the defaults actually apply, and return the parsed parameters

Testing

  • tests/pad-bare-name.test.ts: bare pad renders a 1mm pad (previously crashed), explicit pad_w2mm_h1mm still wins
  • bun test tests/pad-bare-name.test.ts tests/pad.test.ts passes; existing pad snapshot unchanged

pad_def declared w and h with no defaults and pad() read them straight
off the params, so fp.string("pad") crashed with a raw TypeError from
mm(undefined). The sibling smtpad defaults to a 1mm pad, so give pad
the same 1mm default and parse the def so bare-name usage renders.

Fixes tscircuit#788
@Furox-Art

Copy link
Copy Markdown
Author

Friendly maintainer review request: this contribution has been updated with the latest fixes and checks. Please review when convenient. Thank you.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pad throws a raw TypeError from a bare name while smtpad defaults its dimensions

1 participant