diff --git a/app/components/Typography/SrOnlyText.tsx b/app/components/Typography/SrOnlyText.tsx index f6269d8..675d9ef 100644 --- a/app/components/Typography/SrOnlyText.tsx +++ b/app/components/Typography/SrOnlyText.tsx @@ -9,5 +9,5 @@ export const SrOnlyText = ({ as="span" srOnly className="white-space-pre" - >{` ${children}`} + >{` ${String(children)}`} ); diff --git a/app/utilities/loadTimelineData.ts b/app/utilities/loadTimelineData.ts index 150904b..fa4e062 100644 --- a/app/utilities/loadTimelineData.ts +++ b/app/utilities/loadTimelineData.ts @@ -1,14 +1,21 @@ import fs from "fs"; import path from "path"; -export async function loadTimelineData() { +interface TimelineItem { + year: string; + heading: string; + intro: string; + content: string; +} + +export async function loadTimelineData(): Promise { const directoryPath = path.join(process.cwd(), "data/timeline"); const fileNames = fs.readdirSync(directoryPath); - const timelineData = fileNames.map((fileName) => { + const timelineData: TimelineItem[] = fileNames.map((fileName) => { const filePath = path.join(directoryPath, fileName); const fileContents = fs.readFileSync(filePath, "utf8"); - return JSON.parse(fileContents); + return JSON.parse(fileContents) as TimelineItem; }); timelineData.sort((a, b) => parseInt(a.year) - parseInt(b.year));