Skip to content

refactor!: remove any from the public API where it erased type safety#84

Merged
joaomdsg merged 2 commits into
mainfrom
refactor/no-public-any
Jun 2, 2026
Merged

refactor!: remove any from the public API where it erased type safety#84
joaomdsg merged 2 commits into
mainfrom
refactor/no-public-any

Conversation

@joaomdsg

@joaomdsg joaomdsg commented Jun 2, 2026

Copy link
Copy Markdown
Member

Summary

  • sess: Get/Clear now take a Source union constraint (*via.Ctx | *via.CtxR | *http.Request) — call sites unchanged, wrong types are compile errors instead of a silent false.
  • on: all 12 helpers generic over new via.Action (func(*Ctx) | func(*Ctx) error); on.Click(42)/on.Click(nil) no longer compile. Bound-method check remains runtime.
  • h: Switch/Case generic over K comparable; mismatched case keys are compile errors. h.Default[K](node) needs an explicit type argument (nothing to infer from).
  • Session: raw Load/Store/Delete KV unexported; via/sess is the only access path, wired through internal/sessbridge. Public surface is now just Rotate.
  • Adds typed via.BroadcastSignal[T](app, sig, value); string-keyed BroadcastSignals/Patch.Signal(s)/RegisterAppSignal stay as the documented escape hatch for dynamic/client-only signal keys.
  • Out of scope by design: printf-style ...any, Logger.Log kv pairs, echarts JSON map[string]any.

Breaking

  • Session.Load/Store/Delete removed from public API
  • h.Default requires explicit type argument
  • on.*/sess.Get/sess.Clear/h.Switch reject previously-compiling wrong-typed arguments

Testing

  • go build ./..., go vet ./..., go test ./... all green; gofmt clean

joaomdsg added 2 commits June 2, 2026 13:02
sess.Get/Clear take a Source union constraint; on.* helpers take a
via.Action func-union constraint; h.Switch/Case become generic over a
comparable key (h.Default now needs an explicit type argument).
Session's raw Load/Store/Delete KV is unexported — the typed via/sess
package is the only access path, reaching it via internal/sessbridge.
Adds typed via.BroadcastSignal[T]; the string-keyed signal writes
remain as the documented escape hatch for dynamic/client-only keys.
@joaomdsg
joaomdsg merged commit f25e577 into main Jun 2, 2026
6 checks passed
@joaomdsg
joaomdsg deleted the refactor/no-public-any branch June 2, 2026 13:15
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.

1 participant