Skip to content

Commit

Permalink
Merge pull request #643 from 3flex/any-simple-fixes
Browse files Browse the repository at this point in the history
Fix some simple no-explicit-any violations
  • Loading branch information
nielsvanvelzen authored Oct 25, 2024
2 parents d643dee + 8c94160 commit c004df6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
3 changes: 1 addition & 2 deletions src/components/jellyfinActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ function restartPingInterval(reportingParams: PlaybackProgressInfo): void {
stopPingInterval();

if (reportingParams.PlayMethod == 'Transcode') {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
pingInterval = <any>setInterval(() => {
pingInterval = window.setInterval(() => {
pingTranscoder(reportingParams);
}, 1000);
}
Expand Down
11 changes: 6 additions & 5 deletions src/components/maincontroller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type {
BaseItemDto,
MediaStream,
MediaSourceInfo
} from '@jellyfin/sdk/lib/generated-client';
import {
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -415,7 +415,7 @@ export function setSubtitleStreamIndex(
const mediaStreams = state.PlaybackMediaSource?.MediaStreams;

const subtitleStream = getStreamByIndex(
<any>mediaStreams, // eslint-disable-line @typescript-eslint/no-explicit-any
<MediaStream[]>mediaStreams,
'Subtitle',
index
);
Expand Down Expand Up @@ -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>): any {
export function getOptimalMediaSource(
versions: Array<MediaSourceInfo>
): MediaSourceInfo {
let optimalVersion = versions.filter((v) => {
checkDirectPlay(v);

Expand Down
11 changes: 4 additions & 7 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type {
BaseItemDtoQueryResult,
PlaybackProgressInfo,
MediaSourceInfo,
MediaStream,
BaseItemDto,
BaseItemPerson,
UserDto
Expand Down Expand Up @@ -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];

Expand Down Expand Up @@ -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<framework.messages.Track> = [];
Expand Down Expand Up @@ -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<any>,
streams: Array<MediaStream>,
type: string,
index: number
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down

0 comments on commit c004df6

Please sign in to comment.