From b278ae3d3da94892c49f5e8aade3c1279578ebe8 Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Fri, 18 Feb 2022 21:10:29 +0300 Subject: [PATCH] Fix type mismatch TypeScript error --- src/components/pages/UserEditPage.tsx | 4 ++-- src/components/pages/UserParentalControl.tsx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/pages/UserEditPage.tsx b/src/components/pages/UserEditPage.tsx index e2a8ca9d36..1d279711f2 100644 --- a/src/components/pages/UserEditPage.tsx +++ b/src/components/pages/UserEditPage.tsx @@ -1,4 +1,4 @@ -import { UserDto } from '@thornbill/jellyfin-sdk/dist/generated-client'; +import { SyncPlayUserAccessType, UserDto } from '@thornbill/jellyfin-sdk/dist/generated-client'; import React, { FunctionComponent, useCallback, useEffect, useState, useRef } from 'react'; import Dashboard from '../../scripts/clientUtils'; import globalize from '../../scripts/globalize'; @@ -236,7 +236,7 @@ const UserEditPage: FunctionComponent = () => { return c.getAttribute('data-id'); }); if (window.ApiClient.isMinServerVersion('10.6.0')) { - user.Policy.SyncPlayAccess = (page.querySelector('#selectSyncPlayAccess') as HTMLInputElement).value; + user.Policy.SyncPlayAccess = (page.querySelector('#selectSyncPlayAccess') as HTMLInputElement).value as SyncPlayUserAccessType; } window.ApiClient.updateUser(user).then(function () { window.ApiClient.updateUserPolicy(user.Id, user.Policy).then(function () { diff --git a/src/components/pages/UserParentalControl.tsx b/src/components/pages/UserParentalControl.tsx index 64b4f76388..07bac13a57 100644 --- a/src/components/pages/UserParentalControl.tsx +++ b/src/components/pages/UserParentalControl.tsx @@ -226,7 +226,7 @@ const UserParentalControl: FunctionComponent = () => { throw new Error('Unexpected null user.Policy'); } - user.Policy.MaxParentalRating = (page.querySelector('.selectMaxParentalRating') as HTMLInputElement).value || null; + user.Policy.MaxParentalRating = parseInt((page.querySelector('.selectMaxParentalRating') as HTMLInputElement).value || '0', 10) || null; user.Policy.BlockUnratedItems = Array.prototype.filter.call(page.querySelectorAll('.chkUnratedItem'), function (i) { return i.checked; }).map(function (i) { @@ -264,13 +264,13 @@ const UserParentalControl: FunctionComponent = () => { StartHour: elem.getAttribute('data-start'), EndHour: elem.getAttribute('data-end') }; - }); + }) as AccessSchedule[]; }; const getBlockedTagsFromPage = () => { return Array.prototype.map.call(page.querySelectorAll('.blockedTag'), function (elem) { return elem.getAttribute('data-tag'); - }); + }) as string[]; }; const showBlockedTagPopup = () => {