Get rid of some casts

This commit is contained in:
schroda
2024-07-11 17:55:00 +02:00
parent bc01a945db
commit 2f60b94a64
5 changed files with 5 additions and 6 deletions

View File

@@ -194,7 +194,7 @@ export class Chapters {
return [chapterA, matchingChapter]; return [chapterA, matchingChapter];
}) })
.filter((matchingChapters) => matchingChapters !== null) as [Chapter, Chapter][]; .filter((matchingChapters): matchingChapters is [Chapter, Chapter] => matchingChapters !== null);
} }
static async download(chapterIds: number[]): Promise<void> { static async download(chapterIds: number[]): Promise<void> {

View File

@@ -94,7 +94,7 @@ function getExtensionsInfo(extensions: TExtension[]): {
return { return {
allLangs, allLangs,
groupedExtensions: (result as GroupedExtensionsResult).concat(langExt), groupedExtensions: result.concat(langExt),
}; };
} }

View File

@@ -174,7 +174,7 @@ const useSourceManga = (
let allItems: FetchItemsResult = []; let allItems: FetchItemsResult = [];
pages.forEach((page, index) => { pages.forEach((page, index) => {
const pageItems = page.data?.fetchSourceManga?.mangas ?? ([] as FetchItemsResult); const pageItems = page.data?.fetchSourceManga?.mangas ?? [];
const nonLibraryPageItems = pageItems.filter((item) => !hideLibraryEntries || !item.inLibrary); const nonLibraryPageItems = pageItems.filter((item) => !hideLibraryEntries || !item.inLibrary);
const uniqueItems = getUniqueMangas([...allItems, ...nonLibraryPageItems]); const uniqueItems = getUniqueMangas([...allItems, ...nonLibraryPageItems]);

View File

@@ -127,7 +127,7 @@ export const BrowseSettings = () => {
updateSetting('extensionRepos', repos); updateSetting('extensionRepos', repos);
requestManager.clearExtensionCache(); requestManager.clearExtensionCache();
}} }}
valueInfos={serverSettings.extensionRepos.map((extensionRepo) => [extensionRepo]) as [string][]} valueInfos={serverSettings.extensionRepos.map((extensionRepo) => [extensionRepo])}
addItemButtonTitle={t('extension.settings.repositories.custom.dialog.action.button.add')} addItemButtonTitle={t('extension.settings.repositories.custom.dialog.action.button.add')}
placeholder="https://github.com/MY_ACCOUNT/MY_REPO/tree/repo" placeholder="https://github.com/MY_ACCOUNT/MY_REPO/tree/repo"
validateItem={(repo) => validateItem={(repo) =>

View File

@@ -165,7 +165,7 @@ export function Categories() {
<Draggable key={item.id} draggableId={item.id.toString()} index={index}> <Draggable key={item.id} draggableId={item.id.toString()} index={index}>
{(draggableProvided, snapshot) => ( {(draggableProvided, snapshot) => (
<ListItem <ListItem
ContainerProps={{ ref: draggableProvided.innerRef } as any} ref={draggableProvided.innerRef}
{...draggableProvided.draggableProps} {...draggableProvided.draggableProps}
{...draggableProvided.dragHandleProps} {...draggableProvided.dragHandleProps}
style={getItemStyle( style={getItemStyle(
@@ -173,7 +173,6 @@ export function Categories() {
draggableProvided.draggableProps.style, draggableProvided.draggableProps.style,
theme.palette, theme.palette,
)} )}
ref={draggableProvided.innerRef}
> >
<ListItemIcon> <ListItemIcon>
<DragHandleIcon /> <DragHandleIcon />