fix(typescript): resolve 44 TypeScript errors in core components (#1004)

This commit is contained in:
Gauvain
2025-08-31 16:56:53 +02:00
committed by GitHub
parent 83c4aadbb4
commit df0b569f2d
64 changed files with 162 additions and 129 deletions

View File

@@ -14,7 +14,7 @@ export type HapticFeedbackType =
| "error";
export const useHaptic = (feedbackType: HapticFeedbackType = "selection") => {
const [settings] = useSettings();
const [settings] = useSettings(null);
const isTv = Platform.isTV;
const isDisabled =
isTv ||

View File

@@ -1,7 +1,7 @@
import { useEffect, useRef } from "react";
export function useInterval(callback: () => void, delay: number | null) {
const savedCallback = useRef<() => void>();
const savedCallback = useRef<(() => void) | null>(null);
useEffect(() => {
savedCallback.current = callback;

View File

@@ -20,7 +20,7 @@ export const useJellyfinDiscovery = () => {
setServers([]);
const discoveredServers = new Set<string>();
let discoveryTimeout: number;
let discoveryTimeout: ReturnType<typeof setTimeout>;
const socket = dgram.createSocket({
type: "udp4",

View File

@@ -14,7 +14,7 @@ import { useQueryClient } from "@tanstack/react-query";
import { t } from "i18next";
import { useCallback, useMemo } from "react";
import { toast } from "sonner-native";
import type { Settings } from "@/utils/atoms/settings";
import { defaultValues, Settings } from "@/utils/atoms/settings";
import type { RTRating } from "@/utils/jellyseerr/server/api/rating/rottentomatoes";
import {
IssueStatus,
@@ -417,8 +417,8 @@ export class JellyseerrApi {
const jellyseerrUserAtom = atom(storage.get<JellyseerrUser>(JELLYSEERR_USER));
export const useJellyseerr = (
settings: Settings,
updateSettings: (update: Partial<Settings>) => void,
settings: Settings = defaultValues,
updateSettings: (update: Partial<Settings>) => void = () => {},
) => {
const [jellyseerrUser, setJellyseerrUser] = useAtom(jellyseerrUserAtom);
const queryClient = useQueryClient();
@@ -508,7 +508,9 @@ export const useJellyseerr = (
item?: TvResult | TvDetails | MovieResult | MovieDetails,
): MediaType => {
return isJellyseerrResult(item)
? item.mediaType
? item.mediaType === "movie"
? MediaType.MOVIE
: MediaType.TV
: item?.mediaInfo?.mediaType;
};