mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Fix some types
This commit is contained in:
parent
c0c39ab4d0
commit
a8ab835365
@ -65,7 +65,7 @@ export const BaseEpisodeP = withImages(
|
||||
/**
|
||||
* The link to an HLS master playlist containing all qualities available for this video.
|
||||
*/
|
||||
hls: z.string().transform(imageFn),
|
||||
hls: z.string().transform(imageFn).nullable(),
|
||||
}),
|
||||
/**
|
||||
* The id of the show containing this episode
|
||||
|
@ -94,7 +94,7 @@ export const MovieP = withImages(
|
||||
/**
|
||||
* The link to an HLS master playlist containing all qualities available for this video.
|
||||
*/
|
||||
hls: z.string().transform(imageFn),
|
||||
hls: z.string().transform(imageFn).nullable(),
|
||||
}),
|
||||
/**
|
||||
* The link to metadata providers that this show has.
|
||||
|
@ -48,11 +48,10 @@ import {
|
||||
Chip,
|
||||
DottedSeparator,
|
||||
focusReset,
|
||||
SwitchVariant,
|
||||
} from "@kyoo/primitives";
|
||||
import { Fragment } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { ImageStyle, Platform, Text, View } from "react-native";
|
||||
import { ImageStyle, Platform, View } from "react-native";
|
||||
import {
|
||||
Theme,
|
||||
md,
|
||||
@ -70,9 +69,9 @@ import { Fetch } from "../fetch";
|
||||
import PlayArrow from "@material-symbols/svg-400/rounded/play_arrow-fill.svg";
|
||||
import Theaters from "@material-symbols/svg-400/rounded/theaters-fill.svg";
|
||||
import { Rating } from "../components/rating";
|
||||
import { EpisodeLine, displayRuntime, episodeDisplayNumber } from "./episode";
|
||||
import { displayRuntime } from "./episode";
|
||||
import { WatchListInfo } from "../components/watchlist-info";
|
||||
import { ShowWatchStatus, WatchStatusV } from "@kyoo/models/src/resources/watch-status";
|
||||
import { WatchStatusV } from "@kyoo/models/src/resources/watch-status";
|
||||
import { capitalize } from "@kyoo/primitives";
|
||||
import { ShowWatchStatusCard } from "./show";
|
||||
|
||||
|
@ -36,11 +36,6 @@ export type WithLoading<Item> =
|
||||
| (Item & { isLoading: false })
|
||||
| (Partial<Item> & { isLoading: true });
|
||||
|
||||
// We keep a Partial<Item> on the error value to allow destructuring.
|
||||
export type WithError<Item> =
|
||||
| (Item & { isError: false; error: undefined })
|
||||
| (Partial<Item> & { isError: true; error: KyooErrors });
|
||||
|
||||
const isPage = <T = unknown,>(obj: unknown): obj is Page<T> =>
|
||||
(typeof obj === "object" && obj && "items" in obj) || false;
|
||||
|
||||
@ -53,8 +48,8 @@ export const Fetch = <Data,>({
|
||||
placeholderCount?: number;
|
||||
children: (
|
||||
item: Data extends Page<infer Item>
|
||||
? WithError<WithLoading<Item>>
|
||||
: WithError<WithLoading<Data>>,
|
||||
? WithLoading<Item>
|
||||
: WithLoading<Data>,
|
||||
i: number,
|
||||
) => JSX.Element | null;
|
||||
}): JSX.Element | null => {
|
||||
|
@ -28,7 +28,7 @@ declare module "react-native-video" {
|
||||
onMediaUnsupported?: () => void;
|
||||
}
|
||||
export type VideoProps = Omit<VideoProperties, "source"> & {
|
||||
source: { uri: string; hls: string };
|
||||
source: { uri: string; hls: string | null };
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user