refactor: replace any types with proper TypeScript types

Improves type safety throughout the codebase by eliminating unsafe `any` type assertions and replacing them with proper type definitions.

Adds explicit type parameters and constraints to MMKV augmentations, component props, and router navigation calls. Updates function signatures to use `unknown` instead of `any` where appropriate, and properly types Icon glyphs, router Href parameters, and component prop spreads.

Enhances maintainability and catches potential type errors at compile time rather than runtime.
This commit is contained in:
Uruk
2025-11-14 23:48:59 +01:00
committed by Gauvain
parent c05cef295e
commit 75d6948a81
16 changed files with 81 additions and 57 deletions

View File

@@ -1,6 +1,6 @@
import { useActionSheet } from "@expo/react-native-action-sheet";
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models";
import { useRouter, useSegments } from "expo-router";
import { type Href, useRouter, useSegments } from "expo-router";
import { type PropsWithChildren, useCallback } from "react";
import { TouchableOpacity, type TouchableOpacityProps } from "react-native";
import { useFavorite } from "@/hooks/useFavorite";
@@ -146,12 +146,12 @@ export const TouchableItemRouter: React.FC<PropsWithChildren<Props>> = ({
if (isOffline) {
// For offline mode, we still need to use query params
const url = `${itemRouter(item, from)}&offline=true`;
router.push(url as any);
router.push(url as Href);
return;
}
const navigation = getItemNavigation(item, from);
router.push(navigation as any);
router.push(navigation as Href);
}}
{...props}
>