Skip to content

fix: use LayerRef for via route point from_layer/to_layer#521

Merged
seveibar merged 1 commit intotscircuit:mainfrom
dwiel:fix/via-route-point-layer-typing
Mar 18, 2026
Merged

fix: use LayerRef for via route point from_layer/to_layer#521
seveibar merged 1 commit intotscircuit:mainfrom
dwiel:fix/via-route-point-layer-typing

Conversation

@dwiel
Copy link
Contributor

@dwiel dwiel commented Mar 18, 2026

Summary

  • Change PcbTraceRoutePointVia.from_layer and .to_layer from z.string() to layer_ref in both the Zod schema and the TypeScript interface
  • The wire route point variant already uses LayerRef for its layer field — this makes the via variant consistent
  • Eliminates the need for as LayerRef type assertions in downstream consumers (e.g. dsn-converter)

Test plan

  • npx tsc --noEmit passes (no new type errors)
  • bun test passes (200/200, 1 pre-existing skip)
  • Verify downstream consumers (dsn-converter) build cleanly with updated package

PcbTraceRoutePointVia.from_layer and .to_layer were typed as plain
string while the wire variant already used LayerRef. This caused
downstream consumers to need unsafe type assertions when passing
via layers to functions expecting LayerRef.
@rushabhcodes rushabhcodes requested a review from seveibar March 18, 2026 22:41
@seveibar seveibar merged commit fab791a into tscircuit:main Mar 18, 2026
6 checks passed
@dwiel dwiel deleted the fix/via-route-point-layer-typing branch March 19, 2026 00:59
@tscircuitbot
Copy link
Contributor


Thank you for your contribution! 🎉

PR Rating: ⭐⭐⭐
Impact: Major

Track your contributions and see the leaderboard at: tscircuit Contribution Tracker


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.

3 participants