Upgrade TypeScript and core-js

(cherry picked from commit 148480909917f69ff3b2ca547ccb4716dd56606e)

Closes #5306
This commit is contained in:
Mark McDowall 2024-12-08 17:24:47 -08:00 committed by Bogdan
parent 44a5654918
commit 198a13755f
6 changed files with 37 additions and 16 deletions

View file

@ -1,4 +1,5 @@
import { createSelector } from 'reselect';
import AlbumAppState from 'App/State/AlbumAppState';
import AppState from 'App/State/AppState';
import Artist from 'Artist/Artist';
import { createArtistSelectorForHook } from './createArtistSelector';
@ -7,7 +8,7 @@ function createArtistAlbumsSelector(artistId: number) {
return createSelector(
(state: AppState) => state.albums,
createArtistSelectorForHook(artistId),
(albums, artist = {} as Artist) => {
(albums: AlbumAppState, artist = {} as Artist) => {
const { isFetching, isPopulated, error, items } = albums;
const filteredAlbums = items.filter(

View file

@ -1,13 +1,14 @@
import { createSelector } from 'reselect';
import AppState from 'App/State/AppState';
import Artist from 'Artist/Artist';
import MetadataProfile from 'typings/MetadataProfile';
import { createArtistSelectorForHook } from './createArtistSelector';
function createArtistMetadataProfileSelector(artistId: number) {
return createSelector(
(state: AppState) => state.settings.metadataProfiles.items,
createArtistSelectorForHook(artistId),
(metadataProfiles, artist = {} as Artist) => {
(metadataProfiles: MetadataProfile[], artist = {} as Artist) => {
return metadataProfiles.find((profile) => {
return profile.id === artist.metadataProfileId;
});

View file

@ -1,13 +1,14 @@
import { createSelector } from 'reselect';
import AppState from 'App/State/AppState';
import Artist from 'Artist/Artist';
import QualityProfile from 'typings/QualityProfile';
import { createArtistSelectorForHook } from './createArtistSelector';
function createArtistQualityProfileSelector(artistId: number) {
return createSelector(
(state: AppState) => state.settings.qualityProfiles.items,
createArtistSelectorForHook(artistId),
(qualityProfiles, artist = {} as Artist) => {
(qualityProfiles: QualityProfile[], artist = {} as Artist) => {
return qualityProfiles.find(
(profile) => profile.id === artist.qualityProfileId
);

View file

@ -6,15 +6,33 @@ import isTomorrow from 'Utilities/Date/isTomorrow';
import isYesterday from 'Utilities/Date/isYesterday';
import translate from 'Utilities/String/translate';
function getRelativeDate(date, shortDateFormat, showRelativeDates, { timeFormat, includeSeconds = false, timeForToday = false } = {}) {
interface GetRelativeDateOptions {
timeFormat?: string;
includeSeconds?: boolean;
timeForToday?: boolean;
}
function getRelativeDate(
date: string | undefined,
shortDateFormat: string,
showRelativeDates: boolean,
{
timeFormat,
includeSeconds = false,
timeForToday = false,
}: GetRelativeDateOptions = {}
) {
if (!date) {
return null;
return '';
}
const isTodayDate = isToday(date);
if (isTodayDate && timeForToday && timeFormat) {
return formatTime(date, timeFormat, { includeMinuteZero: true, includeSeconds });
return formatTime(date, timeFormat, {
includeMinuteZero: true,
includeSeconds,
});
}
if (!showRelativeDates) {