Skip to content

Commit

Permalink
Fix uncovered type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
captbaritone committed Mar 2, 2024
1 parent c88d8b3 commit cb2254b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions packages/webamp/demo/js/mediaSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
? [
{
Expand Down
4 changes: 2 additions & 2 deletions packages/webamp/js/marqueeUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`;
};

0 comments on commit cb2254b

Please sign in to comment.