diff --git a/src/components/Icon/index.tsx b/src/components/Icon/index.tsx index c3c9ce2..4d1f382 100644 --- a/src/components/Icon/index.tsx +++ b/src/components/Icon/index.tsx @@ -44,7 +44,7 @@ export default function Icon({ name, ...props }: { name: string }) { Contrast } - const IconMapped = components[name] + const IconMapped = components[name as keyof typeof components] return IconMapped ? ( diff --git a/src/components/Location/Location.tsx b/src/components/Location/Location.tsx index cf27f2e..035a949 100644 --- a/src/components/Location/Location.tsx +++ b/src/components/Location/Location.tsx @@ -18,7 +18,7 @@ function Animation({ children }: { children: React.ReactNode }) { aria-label="Location" variants={fadeIn} className={styles.location} - {...getAnimationProps(shouldReduceMotion)} + {...getAnimationProps(shouldReduceMotion || false)} > {children} diff --git a/src/components/ProjectNav/index.tsx b/src/components/ProjectNav/index.tsx index 6e860c1..f44a99d 100644 --- a/src/components/ProjectNav/index.tsx +++ b/src/components/ProjectNav/index.tsx @@ -18,9 +18,13 @@ export default function ProjectNav({ projects, currentSlug }: Props) { useEffect(() => { function scrollToCurrent() { + if (!scrollContainer.current || !currentItem.current) return + const activeItem = currentItem.current - const scrollRect = scrollContainer.current?.getBoundingClientRect() + const scrollRect = scrollContainer.current.getBoundingClientRect() const activeRect = activeItem && activeItem.getBoundingClientRect() + if (!activeItem || !scrollRect || !activeRect) return + const newScrollLeftPosition = activeRect && activeRect.left - diff --git a/src/components/Vcard/imageToDataUrl.test.ts b/src/components/Vcard/imageToDataUrl.test.ts index ab5b922..90e78df 100644 --- a/src/components/Vcard/imageToDataUrl.test.ts +++ b/src/components/Vcard/imageToDataUrl.test.ts @@ -23,7 +23,7 @@ describe('imageToDataUrl', () => { }) it('should convert image to data URL', async () => { - function MockFileReader() { + function MockFileReader(this: any) { this.readAsDataURL = function () { this.result = 'data:image/png;base64,...' setTimeout(() => this.onload(), 0) @@ -33,11 +33,12 @@ describe('imageToDataUrl', () => { window.FileReader = MockFileReader as any const dataUrl = await imageToDataUrl(dummyPath) + expect(dataUrl).toBe('data:image/png;base64,...') }) it('should handle errors in readAsDataURL', async () => { - function MockFileReader() { + function MockFileReader(this: FileReader) { this.readAsDataURL = function () { throw new Error('Mock error') } diff --git a/src/lib/getRepos.test.ts b/src/lib/getRepos.test.ts index b1d8ebc..87296ce 100644 --- a/src/lib/getRepos.test.ts +++ b/src/lib/getRepos.test.ts @@ -5,7 +5,7 @@ import { getRepos } from './getRepos' jest.mock('react', () => ({ ...jest.requireActual('react'), - cache: (fn) => fn + cache: (fn: any) => fn })) describe('getRepos', () => { diff --git a/tsconfig.json b/tsconfig.json index 4538380..26c76a0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, - "strict": false, // TODO: Change to strict: true + "strict": true, "forceConsistentCasingInFileNames": true, "noEmit": true, "esModuleInterop": true,