Skip to content

Commit

Permalink
add noUncheckedIndexedAccess flag to tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
fekoneko committed Dec 4, 2024
1 parent 8fadf2c commit 0e5ea29
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const ImageWorkViewer: FC<ImageWorkViewerProps> = ({ work }) => {
}, [work]);

const asset = work.imageAssets[pageNumber];
if (!asset) return null;

return (
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ export const WorksListCardContent: FC<WorksListCardContentProps> = memo(({ work
{!!work.imageAssets?.length && (
<div className="relative size-full">
<div className="relative flex size-full items-center transition-all [clip-path:rect(0_100%_100%_0_round_0.5rem)] hover:z-20 hover:translate-x-1 hover:[clip-path:rect(-100%_300%_300%_-100%_round_0.5rem)]">
<ImageView
src={convertFileSrc(work.imageAssets[0].path)}
width={work.imageAssets[0].dimensions.width}
height={work.imageAssets[0].dimensions.height}
className="pointer-events-none absolute w-full rounded-lg transition-transform [:hover>&]:scale-[1.2] [:hover>&]:shadow-md"
/>
{work.imageAssets[0] && (
<ImageView
src={convertFileSrc(work.imageAssets[0].path)}
width={work.imageAssets[0].dimensions.width}
height={work.imageAssets[0].dimensions.height}
className="pointer-events-none absolute w-full rounded-lg transition-transform [:hover>&]:scale-[1.2] [:hover>&]:shadow-md"
/>
)}
</div>
<p className="absolute right-0 top-0 -mr-2 -mt-0.5 rounded-lg bg-paper px-2 text-text shadow-md transition-colors [:hover>&]:invisible">
x{work.imageAssets.length}
Expand Down
4 changes: 2 additions & 2 deletions src/components/header/CollectionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const CollectionButton: FC = () => {
const recentSelectRef = useRef<HTMLSelectElement>(null);

useEffect(() => {
if (!recentPaths || recentPaths.length === 0 || collectionName !== null) return;
if (!recentPaths || recentPaths[0] === undefined || collectionName !== null) return;
switchCollection(recentPaths[0]);
}, [recentPaths, collectionName, switchCollection]);

Expand Down Expand Up @@ -51,7 +51,7 @@ export const CollectionButton: FC = () => {
<select
ref={recentSelectRef}
className="mt-0.5 w-[16.5px] cursor-pointer bg-transparent [zoom:1.4] focus:outline-none"
onChange={(e) => switchCollection(recentPaths[e.target.selectedIndex])}
onChange={(e) => switchCollection(recentPaths[e.target.selectedIndex]!)}
>
{recentPaths.map((path) => (
<option key={path} className="bg-background px-3 text-text [zoom:0.65]">
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true
},
"include": ["src"]
}
3 changes: 2 additions & 1 deletion tsconfig.bun.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"strict": true,
"noEmit": true
"noEmit": true,
"noUncheckedIndexedAccess": true
},
"include": ["plugins", "vite.config.ts"]
}

0 comments on commit 0e5ea29

Please sign in to comment.