mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 04:04:21 -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.
|
* 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
|
* 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.
|
* 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.
|
* The link to metadata providers that this show has.
|
||||||
|
@ -48,11 +48,10 @@ import {
|
|||||||
Chip,
|
Chip,
|
||||||
DottedSeparator,
|
DottedSeparator,
|
||||||
focusReset,
|
focusReset,
|
||||||
SwitchVariant,
|
|
||||||
} from "@kyoo/primitives";
|
} from "@kyoo/primitives";
|
||||||
import { Fragment } from "react";
|
import { Fragment } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { ImageStyle, Platform, Text, View } from "react-native";
|
import { ImageStyle, Platform, View } from "react-native";
|
||||||
import {
|
import {
|
||||||
Theme,
|
Theme,
|
||||||
md,
|
md,
|
||||||
@ -70,9 +69,9 @@ import { Fetch } from "../fetch";
|
|||||||
import PlayArrow from "@material-symbols/svg-400/rounded/play_arrow-fill.svg";
|
import PlayArrow from "@material-symbols/svg-400/rounded/play_arrow-fill.svg";
|
||||||
import Theaters from "@material-symbols/svg-400/rounded/theaters-fill.svg";
|
import Theaters from "@material-symbols/svg-400/rounded/theaters-fill.svg";
|
||||||
import { Rating } from "../components/rating";
|
import { Rating } from "../components/rating";
|
||||||
import { EpisodeLine, displayRuntime, episodeDisplayNumber } from "./episode";
|
import { displayRuntime } from "./episode";
|
||||||
import { WatchListInfo } from "../components/watchlist-info";
|
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 { capitalize } from "@kyoo/primitives";
|
||||||
import { ShowWatchStatusCard } from "./show";
|
import { ShowWatchStatusCard } from "./show";
|
||||||
|
|
||||||
|
@ -36,11 +36,6 @@ export type WithLoading<Item> =
|
|||||||
| (Item & { isLoading: false })
|
| (Item & { isLoading: false })
|
||||||
| (Partial<Item> & { isLoading: true });
|
| (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> =>
|
const isPage = <T = unknown,>(obj: unknown): obj is Page<T> =>
|
||||||
(typeof obj === "object" && obj && "items" in obj) || false;
|
(typeof obj === "object" && obj && "items" in obj) || false;
|
||||||
|
|
||||||
@ -53,8 +48,8 @@ export const Fetch = <Data,>({
|
|||||||
placeholderCount?: number;
|
placeholderCount?: number;
|
||||||
children: (
|
children: (
|
||||||
item: Data extends Page<infer Item>
|
item: Data extends Page<infer Item>
|
||||||
? WithError<WithLoading<Item>>
|
? WithLoading<Item>
|
||||||
: WithError<WithLoading<Data>>,
|
: WithLoading<Data>,
|
||||||
i: number,
|
i: number,
|
||||||
) => JSX.Element | null;
|
) => JSX.Element | null;
|
||||||
}): JSX.Element | null => {
|
}): JSX.Element | null => {
|
||||||
|
@ -28,7 +28,7 @@ declare module "react-native-video" {
|
|||||||
onMediaUnsupported?: () => void;
|
onMediaUnsupported?: () => void;
|
||||||
}
|
}
|
||||||
export type VideoProps = Omit<VideoProperties, "source"> & {
|
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