chore(ts): drop two more redundant casts

- RouteMapThumbnail.client.tsx: `{ type: 'Feature', ... } as unknown
  as GeoJsonObject` → `as GeoJsonObject`. The literal already
  satisfies the type; the unknown bridge was unnecessary.

- use-yjs.ts:102: keep the coercion (y-websocket's `.on()` signature
  doesn't include the legacy `"synced"` event even though the
  runtime still fires it), but document why with a comment so future
  readers don't try to drop it.
This commit is contained in:
Ullrich Schäfer 2026-05-26 01:02:49 +02:00
parent 985ec54023
commit a724f862b8
No known key found for this signature in database
GPG key ID: A32FF691A0F752D9
2 changed files with 5 additions and 1 deletions

View file

@ -142,7 +142,7 @@ function DayColoredRoute({ data, dayBreaks, highlightedDay }: { data: GeoJsonObj
type: "Feature", type: "Feature",
geometry: { type: "LineString", coordinates: seg.coords }, geometry: { type: "LineString", coordinates: seg.coords },
properties: {}, properties: {},
} as unknown as GeoJsonObject; } as GeoJsonObject;
return ( return (
<GeoJSON <GeoJSON
key={`${i}-${highlightedDay}`} key={`${i}-${highlightedDay}`}

View file

@ -99,6 +99,10 @@ export function useYjs(
// Initialize waypoints once after first sync // Initialize waypoints once after first sync
if (initialWaypoints?.length && !initializedWaypoints.current) { if (initialWaypoints?.length && !initializedWaypoints.current) {
// y-websocket emits both "sync" and "synced" (legacy alias). We
// keep "synced" for backwards-compat with older versions; the
// typed `.on` signature in the current lib version omits it
// even though the runtime still fires it, so we coerce.
(provider as unknown as { on(event: string, cb: () => void): void }).on("synced", () => { (provider as unknown as { on(event: string, cb: () => void): void }).on("synced", () => {
// Only add if the doc is empty (avoid duplicating on reconnect) // Only add if the doc is empty (avoid duplicating on reconnect)
if (waypoints.length === 0 && !initializedWaypoints.current) { if (waypoints.length === 0 && !initializedWaypoints.current) {