E frontend reconciliation (2/2): align consumers to generated bindings; svelte-check clean
Reconcile the ~50 frontend files that consumed the old hand-written types against
the stricter generated bindings (141 -> 0 svelte-check errors):
- Nullable strictness: null-coalesce/guard at consumer sites; widen shared helpers
(CachedImage.tag, ticksToSeconds, formatDuration, getSessionIcon, session store
send*/transferToRemote) to accept null.
- Field-name fixes exposed by codegen: userData.played -> isPlayed; remote
NowPlayingItem uses album (not albumName); ArtistItem id/name.
- player.ts: normalize remote NowPlayingItem -> MediaItem in mergedMedia.
- ArtistItem now serializes camelCase (PascalCase alias retained for Jellyfin
deserialize); update its serialize test.
- Update downloads.test.ts to the bundled { request } shape; complete the
sessions.test.ts NowPlayingItem mock.
Frontend: svelte-check 0 errors, vitest 448 passing. Backend: 387 passing.
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
if (!episode.userData || !episode.runTimeTicks) {
|
||||
return 0;
|
||||
}
|
||||
return (episode.userData.playbackPositionTicks / episode.runTimeTicks) * 100;
|
||||
return ((episode.userData.playbackPositionTicks ?? 0) / episode.runTimeTicks) * 100;
|
||||
});
|
||||
|
||||
const duration = $derived(formatDuration(episode.runTimeTicks));
|
||||
@@ -137,7 +137,7 @@
|
||||
{episode.name}
|
||||
</h3>
|
||||
<!-- Played indicator -->
|
||||
{#if episode.userData?.played}
|
||||
{#if episode.userData?.isPlayed}
|
||||
<svg class="w-4 h-4 flex-shrink-0 text-[var(--color-jellyfin)]" fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>
|
||||
</svg>
|
||||
@@ -164,10 +164,10 @@
|
||||
<VideoDownloadButton
|
||||
itemId={episode.id}
|
||||
itemName={episode.name}
|
||||
seriesName={episode.seriesName}
|
||||
seasonName={episode.seasonName}
|
||||
episodeNumber={episode.indexNumber}
|
||||
seasonNumber={episode.parentIndexNumber}
|
||||
seriesName={episode.seriesName ?? undefined}
|
||||
seasonName={episode.seasonName ?? undefined}
|
||||
episodeNumber={episode.indexNumber ?? undefined}
|
||||
seasonNumber={episode.parentIndexNumber ?? undefined}
|
||||
size="sm"
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user