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>
This commit is contained in:
parent
ec86f722d9
commit
985ec54023
8 changed files with 45 additions and 12 deletions
|
|
@ -9,7 +9,6 @@ import { fitToGpx } from "../../fit.ts";
|
|||
import { fetchWithTimeout } from "../../../http.server.ts";
|
||||
import { isAlreadyImported, importActivity } from "../../../sync/imports.server.ts";
|
||||
import { getServiceByProviderUser, withFreshCredentials } from "../../manager.ts";
|
||||
import type { OAuthCredentials } from "../../types.ts";
|
||||
import type { WebhookEvent, WebhookReceiver } from "../../registry.ts";
|
||||
|
||||
interface WahooWebhookBody {
|
||||
|
|
@ -52,8 +51,7 @@ export const wahooWebhook: WebhookReceiver = {
|
|||
// through withFreshCredentials so the manager has a chance to refresh
|
||||
// a near-expired credential before any subsequent Wahoo call this
|
||||
// handler might make.
|
||||
const buffer = await withFreshCredentials(service.id, async (_creds) => {
|
||||
void (_creds as unknown as OAuthCredentials);
|
||||
const buffer = await withFreshCredentials(service.id, async () => {
|
||||
const resp = await fetchWithTimeout(event.fileUrl!);
|
||||
if (!resp.ok) throw new Error(`Wahoo file download failed: ${resp.status}`);
|
||||
return Buffer.from(await resp.arrayBuffer());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue