From 8c94160f02413e2baa56fa5eb202432882dce611 Mon Sep 17 00:00:00 2001 From: Matthew Haughton <3flex@users.noreply.github.com> Date: Fri, 25 Oct 2024 20:14:25 +1100 Subject: [PATCH] Fix some simple no-explicit-any violations --- src/components/jellyfinActions.ts | 3 +-- src/components/maincontroller.ts | 11 ++++++----- src/helpers.ts | 11 ++++------- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/components/jellyfinActions.ts b/src/components/jellyfinActions.ts index b5ffcbd9..64bc9f25 100644 --- a/src/components/jellyfinActions.ts +++ b/src/components/jellyfinActions.ts @@ -34,8 +34,7 @@ function restartPingInterval(reportingParams: PlaybackProgressInfo): void { stopPingInterval(); if (reportingParams.PlayMethod == 'Transcode') { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - pingInterval = setInterval(() => { + pingInterval = window.setInterval(() => { pingTranscoder(reportingParams); }, 1000); } diff --git a/src/components/maincontroller.ts b/src/components/maincontroller.ts index 484aa746..f718796d 100644 --- a/src/components/maincontroller.ts +++ b/src/components/maincontroller.ts @@ -1,5 +1,6 @@ import type { BaseItemDto, + MediaStream, MediaSourceInfo } from '@jellyfin/sdk/lib/generated-client'; import { @@ -386,8 +387,7 @@ export function setSubtitleStreamIndex( // FIXME: Possible index error when MediaStreams is undefined. const currentSubtitleStream = state.mediaSource?.MediaStreams?.filter( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (m: any) => { + (m: MediaStream) => { return m.Index == state.subtitleStreamIndex && m.Type == 'Subtitle'; } )[0]; @@ -415,7 +415,7 @@ export function setSubtitleStreamIndex( const mediaStreams = state.PlaybackMediaSource?.MediaStreams; const subtitleStream = getStreamByIndex( - mediaStreams, // eslint-disable-line @typescript-eslint/no-explicit-any + mediaStreams, 'Subtitle', index ); @@ -706,8 +706,9 @@ export function showPlaybackInfoErrorMessage(error: string): void { * @param versions - versions * @returns stream */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export function getOptimalMediaSource(versions: Array): any { +export function getOptimalMediaSource( + versions: Array +): MediaSourceInfo { let optimalVersion = versions.filter((v) => { checkDirectPlay(v); diff --git a/src/helpers.ts b/src/helpers.ts index 9003e704..4f420766 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -2,6 +2,7 @@ import type { BaseItemDtoQueryResult, PlaybackProgressInfo, MediaSourceInfo, + MediaStream, BaseItemDto, BaseItemPerson, UserDto @@ -93,9 +94,7 @@ export function getSenderReportingData( nowPlayingItem.ServerId = item.ServerId; nowPlayingItem.Chapters = item.Chapters || []; - // TODO: Fill these - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const mediaSource = item.MediaSources?.filter((m: any) => { + const mediaSource = item.MediaSources?.filter((m: MediaSourceInfo) => { return m.Id == reportingData.MediaSourceId; })[0]; @@ -400,8 +399,7 @@ export function createStreamInfo( }; const subtitleStreams = - // eslint-disable-next-line @typescript-eslint/no-explicit-any - mediaSource.MediaStreams?.filter((stream: any) => { + mediaSource.MediaStreams?.filter((stream: MediaStream) => { return stream.Type === 'Subtitle'; }) ?? []; const subtitleTracks: Array = []; @@ -451,8 +449,7 @@ export function createStreamInfo( * @returns first first matching stream */ export function getStreamByIndex( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - streams: Array, + streams: Array, type: string, index: number // eslint-disable-next-line @typescript-eslint/no-explicit-any