Merge pull request #3471 from thornbill/fix-more-type-warnings

Fix remaining any type warnings
This commit is contained in:
Bill Thornton 2022-02-28 13:02:15 -05:00 committed by GitHub
commit 8c07a626fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 7 deletions

2
src/apiclient.d.ts vendored
View File

@ -1,4 +1,5 @@
// TODO: Move to jellyfin-apiclient
/* eslint-disable @typescript-eslint/no-explicit-any */
declare module 'jellyfin-apiclient' {
import {
AllThemeMediaResult,
@ -348,3 +349,4 @@ declare module 'jellyfin-apiclient' {
trigger(obj: any, eventName: string, ...args: any[]): void;
};
}
/* eslint-enable @typescript-eslint/no-explicit-any */

View File

@ -26,10 +26,10 @@ const createButtonElement = () => ({
});
type IProps = {
user?: Record<string, any>;
user?: UserDto;
}
const getLastSeenText = (lastActivityDate?: string) => {
const getLastSeenText = (lastActivityDate?: string | null) => {
if (lastActivityDate) {
return globalize.translate('LastSeen', formatDistanceToNow(Date.parse(lastActivityDate), localeWithSuffix));
}
@ -37,16 +37,16 @@ const getLastSeenText = (lastActivityDate?: string) => {
return '';
};
const UserCardBox: FunctionComponent<IProps> = ({ user = [] }: IProps) => {
const UserCardBox: FunctionComponent<IProps> = ({ user = {} }: IProps) => {
let cssClass = 'card squareCard scalableCard squareCard-scalable';
if (user.Policy.IsDisabled) {
if (user.Policy?.IsDisabled) {
cssClass += ' grayscale';
}
let imgUrl;
if (user.PrimaryImageTag) {
if (user.PrimaryImageTag && user.Id) {
imgUrl = window.ApiClient.getUserImageUrl(user.Id, {
width: 300,
tag: user.PrimaryImageTag,
@ -56,7 +56,7 @@ const UserCardBox: FunctionComponent<IProps> = ({ user = [] }: IProps) => {
let imageClass = 'cardImage';
if (user.Policy.IsDisabled) {
if (user.Policy?.IsDisabled) {
imageClass += ' disabledUser';
}

View File

@ -16,10 +16,31 @@ const createScroller = ({ title = '' }) => ({
</div>`
});
type CardOptions = {
itemsContainer?: HTMLElement,
parentContainer?: HTMLElement,
allowBottomPadding?: boolean,
centerText?: boolean,
coverImage?: boolean,
inheritThumb?: boolean,
overlayMoreButton?: boolean,
overlayText?: boolean,
preferThumb?: boolean,
scalable?: boolean,
shape?: string,
showParentTitle?: boolean,
showParentTitleOrTitle?: boolean,
showAirTime?: boolean,
showAirDateTime?: boolean,
showChannelName?: boolean,
showTitle?: boolean,
showYear?: boolean
}
type SearchResultsRowProps = {
title?: string;
items?: BaseItemDto[];
cardOptions?: Record<string, any>;
cardOptions?: CardOptions;
}
const SearchResultsRow: FunctionComponent<SearchResultsRowProps> = ({ title, items = [], cardOptions = {} }: SearchResultsRowProps) => {