trails/apps/journal/app/lib/connected-services
Ullrich Schäfer 985ec54023
chore(ts): replace 7 \as unknown as\ shims with proper types
Most of the existing coercions are legitimate (Drizzle raw-SQL row
shapes, linkedom DOMParser interop, fit-file-parser's loose \`any\`
callback API) — leaving those is honest. The ones cleaned up here
were shims around APIs that have real types we just hadn't wired:

- **\`window.__leafletMap\`** (4 sites: MapHelpers.tsx, SessionView.tsx ×3)
  Added \`Window\` declaration in \`apps/planner/app/types/global.d.ts\`.
  Callers now use plain \`window.__leafletMap\` typed as
  \`L.Map | undefined\`.

- **\`L.markerClusterGroup\`** (PoiPanel.tsx) — leaflet.markercluster
  augments the global \`L\` namespace at runtime but ships no types.
  Added a \`declare module \"leaflet\"\` block in the same global.d.ts
  with a minimal signature for what we actually use.

- **\`L.DomEvent.preventDefault / .stop\`** taking a Leaflet event
  rather than a native one (PlannerMap.tsx, RouteInteraction.tsx,
  NoGoAreaLayer.tsx). Leaflet events carry the native event under
  \`.originalEvent\`; using that drops the cast entirely.

- **\`_creds as unknown as OAuthCredentials\`** orphan in
  wahoo/webhook.ts — \`_creds\` was unused inside the callback (the
  void-cast was a no-op preserving the type for documentation).
  Replaced with \`async ()\`, dropped the unused import.

Net: 26 \`as unknown as\` / \`as any\` sites → 19, all remaining ones
gated by external lib interop or Drizzle raw-SQL.

Full repo: pnpm typecheck / lint / test all green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 01:02:25 +02:00
..
credential-adapters Add Komoot import with public (bio verification) and authenticated modes 2026-05-23 10:18:46 +02:00
providers chore(ts): replace 7 \as unknown as\ shims with proper types 2026-05-26 01:02:25 +02:00
fit.ts Deepen three architectural seams: FIT consolidation, host election extraction, injectable db 2026-05-10 15:52:31 +02:00
index.ts Wahoo capability adapters + caller migration (groups 3-5) 2026-05-08 01:25:33 +02:00
manager.test.ts Schema rename + ConnectedServiceManager foundation (groups 1-2) 2026-05-08 01:14:38 +02:00
manager.ts Schema rename + ConnectedServiceManager foundation (groups 1-2) 2026-05-08 01:14:38 +02:00
oauth-state.server.ts Wahoo capability adapters + caller migration (groups 3-5) 2026-05-08 01:25:33 +02:00
push-action.server.ts Wahoo capability adapters + caller migration (groups 3-5) 2026-05-08 01:25:33 +02:00
registry.ts Add Komoot import with public (bio verification) and authenticated modes 2026-05-23 10:18:46 +02:00
types.ts Add Komoot import with public (bio verification) and authenticated modes 2026-05-23 10:18:46 +02:00