Fix uncovered type errors

This commit is contained in:
Jordan Eldredge 2024-03-02 12:24:41 -08:00
parent c88d8b390e
commit cb2254bdb7
2 changed files with 5 additions and 6 deletions

View file

@ -10,11 +10,10 @@ export default function enableMediaSession(webamp: WebampLazy) {
const {
metaData: { title, artist, album, albumArtUrl },
} = track;
// @ts-ignore TypeScript does not know about the Media Session API: https://github.com/Microsoft/TypeScript/issues/19473
navigator.mediaSession.metadata = new MediaMetadata({
title,
artist,
album,
title: title ?? undefined,
artist: artist ?? undefined,
album: album ?? undefined,
artwork: albumArtUrl
? [
{

View file

@ -31,7 +31,7 @@ const formatHz = (hz: number): string =>
hz < 1000 ? `${hz}HZ` : `${hz / 1000}KHZ`;
// Format a number as a string, ensuring it has a + or - sign
const ensureSign = (num: number | string): string =>
const ensureSign = (num: number): string =>
num > 0 ? `+${num}` : num.toString();
// Round to 1 and exactly 1 decimal point
@ -41,5 +41,5 @@ const roundToTenths = (num: number): string =>
export const getEqText = (band: Slider, level: number): string => {
const db = roundToTenths(((level - 50) / 50) * 12);
const label = band === "preamp" ? "Preamp" : formatHz(band);
return `EQ: ${label} ${ensureSign(db)} DB`;
return `EQ: ${label} ${ensureSign(Number(db))} DB`;
};