Personal Site

Sanely type nowPlayingSongID

vielle.dev b16e5eed a6b0a787

verified
+1 -4
+1 -4
src/components/playing/spotify.ts
··· 169 169 if (res instanceof Error) return res; 170 170 171 171 // https://developer.spotify.com/documentation/web-api/reference/get-the-users-currently-playing-track 172 - const trackID = (res as { item: { id: string } | null }).item?.id; 173 - if (trackID === null) return null; 174 - 175 - return trackID; 172 + return (res as { item: { id: string } | null }).item?.id ?? null; 176 173 } 177 174 178 175 export async function getTrack(id: string) {