Skip to content

Commit 5010718

Browse files
committed
Fix TS issues.
1 parent 822fd55 commit 5010718

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/pages/jobs.astro

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,23 @@ import TwoCols from "@components/TwoCols.astro";
1010
const companies = await getCollection("companies");
1111
1212
const jobFiles = import.meta.glob("../content/companies/*/!(index).md");
13-
const companiesJobsMap = {};
13+
const companiesJobsMap: Record<string, CollectionEntry<"jobs">[]> = {};
1414
1515
for (const path in jobFiles) {
1616
const match = path.match(/\.\.\/content\/companies\/([^/]+)\/([^/]+)\.md$/);
1717
if (match) {
1818
const companyId = match[1];
19-
if (!companiesJobsMap[companyId]) companiesJobsMap[companyId] = [];
20-
companiesJobsMap[companyId].push(
21-
await getEntry("jobs", `${companyId}/${match[2]}`),
22-
);
19+
const jobId = match[2];
20+
21+
const entry = await getEntry("jobs", `${companyId}/${jobId}`);
22+
if (entry) {
23+
if (!companiesJobsMap[companyId]) {
24+
companiesJobsMap[companyId] = [];
25+
}
26+
companiesJobsMap[companyId].push(entry);
27+
} else {
28+
console.warn(`Job entry not found for: ${companyId}/${jobId}`);
29+
}
2330
}
2431
}
2532
---

0 commit comments

Comments
 (0)