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:
@@ -89,7 +89,7 @@ function createSessionsStore() {
|
||||
/**
|
||||
* Send play/pause toggle command
|
||||
*/
|
||||
async function sendPlayPause(sessionId: string): Promise<void> {
|
||||
async function sendPlayPause(sessionId: string | null | undefined): Promise<void> {
|
||||
try {
|
||||
await invoke("remote_send_command", {
|
||||
sessionId,
|
||||
@@ -106,7 +106,7 @@ function createSessionsStore() {
|
||||
/**
|
||||
* Send stop command
|
||||
*/
|
||||
async function sendStop(sessionId: string): Promise<void> {
|
||||
async function sendStop(sessionId: string | null | undefined): Promise<void> {
|
||||
try {
|
||||
await invoke("remote_send_command", {
|
||||
sessionId,
|
||||
@@ -122,7 +122,7 @@ function createSessionsStore() {
|
||||
/**
|
||||
* Send next track command
|
||||
*/
|
||||
async function sendNext(sessionId: string): Promise<void> {
|
||||
async function sendNext(sessionId: string | null | undefined): Promise<void> {
|
||||
try {
|
||||
await invoke("remote_send_command", {
|
||||
sessionId,
|
||||
@@ -138,7 +138,7 @@ function createSessionsStore() {
|
||||
/**
|
||||
* Send previous track command
|
||||
*/
|
||||
async function sendPrevious(sessionId: string): Promise<void> {
|
||||
async function sendPrevious(sessionId: string | null | undefined): Promise<void> {
|
||||
try {
|
||||
await invoke("remote_send_command", {
|
||||
sessionId,
|
||||
@@ -154,7 +154,7 @@ function createSessionsStore() {
|
||||
/**
|
||||
* Seek to position (in ticks)
|
||||
*/
|
||||
async function sendSeek(sessionId: string, positionTicks: number): Promise<void> {
|
||||
async function sendSeek(sessionId: string | null | undefined, positionTicks: number): Promise<void> {
|
||||
try {
|
||||
await invoke("remote_session_seek", {
|
||||
sessionId,
|
||||
@@ -170,7 +170,7 @@ function createSessionsStore() {
|
||||
/**
|
||||
* Set volume (0-100)
|
||||
*/
|
||||
async function sendVolume(sessionId: string, volume: number): Promise<void> {
|
||||
async function sendVolume(sessionId: string | null | undefined, volume: number): Promise<void> {
|
||||
try {
|
||||
await invoke("remote_session_set_volume", {
|
||||
sessionId,
|
||||
@@ -186,7 +186,7 @@ function createSessionsStore() {
|
||||
/**
|
||||
* Toggle mute
|
||||
*/
|
||||
async function sendToggleMute(sessionId: string): Promise<void> {
|
||||
async function sendToggleMute(sessionId: string | null | undefined): Promise<void> {
|
||||
try {
|
||||
await invoke("remote_send_command", {
|
||||
sessionId,
|
||||
@@ -203,7 +203,7 @@ function createSessionsStore() {
|
||||
* Play item(s) on remote session
|
||||
*/
|
||||
async function playOnSession(
|
||||
sessionId: string,
|
||||
sessionId: string | null | undefined,
|
||||
itemIds: string[],
|
||||
startIndex = 0
|
||||
): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user