Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

refactor: enhance type safety in resume-related components and update TypeScript configuration

Khuram Niaz302d1defa7de
diff --git a/src/app/api/profile/resume/route.ts b/src/app/api/profile/resume/route.ts
index cfd617e..55cb077 100644
--- a/src/app/api/profile/resume/route.ts
+++ b/src/app/api/profile/resume/route.ts
@@ -12,7 +12,7 @@ import { getTimestampedFileName } from "@/lib/utils";
import { APP_CONSTANTS } from "@/lib/constants";
import { PDF_MAGIC, ZIP_MAGIC } from "@/lib/ai/import/extract-text";
-const ALLOWED_MIME = new Set(APP_CONSTANTS.RESUME_ALLOWED_MIME_TYPES);
+const ALLOWED_MIME = new Set<string>(APP_CONSTANTS.RESUME_ALLOWED_MIME_TYPES);
function validateFileBytes(buf: Buffer, mimeType: string): boolean {
if (mimeType === "application/pdf") return buf.subarray(0, 4).equals(PDF_MAGIC);
diff --git a/src/components/profile/AiResumeReviewSection.tsx b/src/components/profile/AiResumeReviewSection.tsx
index 744129a..ce4760e 100644
--- a/src/components/profile/AiResumeReviewSection.tsx
+++ b/src/components/profile/AiResumeReviewSection.tsx
@@ -15,7 +15,7 @@ import Loading from "../Loading";
import { useState, useEffect, useCallback } from "react";
import { toast } from "../ui/use-toast";
import { Resume } from "@/models/profile.model";
-import { AiModel, defaultModel } from "@/models/ai.model";
+import { AiModel, AiProvider, defaultModel } from "@/models/ai.model";
import { AiResumeReviewResponseContent } from "./AiResumeReviewResponseContent";
import {
Tooltip,
@@ -40,7 +40,7 @@ const AiResumeReviewSection = ({ resume }: AiSectionProps) => {
const [selectedModel, setSelectedModel] = useState<AiModel>(defaultModel);
const [isLoadingSettings, setIsLoadingSettings] = useState(false);
- const checkConnectionStatus = useCallback(async (provider: string) => {
+ const checkConnectionStatus = useCallback(async (provider: AiProvider) => {
setOllamaConnected(null);
setConnectionError("");
const result = await checkOllamaConnection(provider);
diff --git a/src/components/profile/resume-pdf/generateResumePdf.tsx b/src/components/profile/resume-pdf/generateResumePdf.tsx
index d5bc9a3..bc3b75c 100644
--- a/src/components/profile/resume-pdf/generateResumePdf.tsx
+++ b/src/components/profile/resume-pdf/generateResumePdf.tsx
@@ -63,7 +63,7 @@ export async function generateResumePdfBlob(
document = <SimpleResumeDocument resume={resume} htmlNodes={htmlNodes} />;
}
- const blob = await pdf(document).toBlob();
+ const blob = await pdf(document as any).toBlob();
const filename = `${sanitizeFilename(resume.title)} - ${RESUME_LAYOUT_LABELS[layout]}.pdf`;
return { blob, filename };
}
diff --git a/src/components/profile/resume-pdf/types.ts b/src/components/profile/resume-pdf/types.ts
index 221e078..2480b56 100644
--- a/src/components/profile/resume-pdf/types.ts
+++ b/src/components/profile/resume-pdf/types.ts
@@ -1,3 +1,5 @@
+import type { Style } from "@react-pdf/types";
+
export type ResumeLayout = "simple" | "professional";
export const RESUME_LAYOUT_LABELS: Record<ResumeLayout, string> = {
@@ -6,13 +8,13 @@ export const RESUME_LAYOUT_LABELS: Record<ResumeLayout, string> = {
};
export type HtmlStyleSet = {
- bodyText: object;
- bold: object;
- italic: object;
- boldItalic: object;
- h2text: object;
- listRow: object;
- bullet: object;
- listText: object;
+ bodyText: Style;
+ bold: Style;
+ italic: Style;
+ boldItalic: Style;
+ h2text: Style;
+ listRow: Style;
+ bullet: Style;
+ listText: Style;
bulletChar: string;
};
diff --git a/tsconfig.json b/tsconfig.json
index 7acabdc..507b8c8 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -30,5 +30,5 @@
".next/types/**/*.ts",
"src/lib/data/seedData.js"
],
- "exclude": ["node_modules"]
+ "exclude": ["node_modules", "scripts"]
}