Skip to content

Commit

Permalink
fix strict null checks
Browse files Browse the repository at this point in the history
build modifies tsconfig.json to include anyway
  • Loading branch information
justin-hackin committed Mar 17, 2023
1 parent b08629a commit 0f32408
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/cms-integration/achievements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ export const getAchievements = async (): Promise<CMSAchievement[]> => {
},
],
});

return document.results.map(({ id, data }) => ({
slug: id,
attributes: {
achievement: data.achievement_title,
completionYear: data.year,
institution: data.organization_name,
},
html: asHTML(data.achievement_description),
html: asHTML(data.achievement_description) || '',
}));
};
9 changes: 6 additions & 3 deletions src/cms-integration/common.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import prismic, { getEndpoint } from '@prismicio/client';

const { CMS_REPO_NAME, CMS_ACCESS_TOKEN } = process.env;
export const cmsClient = prismic.createClient(getEndpoint(CMS_REPO_NAME), {
accessToken: CMS_ACCESS_TOKEN,
});
export const cmsClient = prismic.createClient(
getEndpoint(CMS_REPO_NAME || ''),
{
accessToken: CMS_ACCESS_TOKEN,
},
);
2 changes: 1 addition & 1 deletion src/cms-integration/hobbies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export interface CMSHobbies {
export const getHobbies = async (): Promise<CMSHobbies> => {
const { data } = await cmsClient.getSingle('personal_information', {});
return {
html: asHTML(data.hobbies_and_interests),
html: asHTML(data.hobbies_and_interests) || '',
};
};
2 changes: 1 addition & 1 deletion src/cms-integration/personal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ export const prismicGetPersonalInformation =
givenName: data.given_name,
location: data.location,
},
html: asHTML(data.about_me_description),
html: asHTML(data.about_me_description) || '',
};
};
2 changes: 1 addition & 1 deletion src/cms-integration/private.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ export const getPrivateInformation = async (): Promise<
label: data.label,
icon: iconNameToIcon[data.icon_name],
},
html: asHTML(data.content, null, stripParagraphHtmlSerializer),
html: asHTML(data.content, null, stripParagraphHtmlSerializer) || '',
}));
};
5 changes: 2 additions & 3 deletions src/cms-integration/professional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@ export const prismicGetProfessionalExperiences = async (): Promise<
{ field: 'my.professional_experience.end_date', direction: 'desc' },
], //'[my.professional_experience.is_current desc, my.professional_experience.end_date desc]',
});
const experiences = document.results.map(({ data, id }) => ({
return document.results.map(({ data, id }) => ({
slug: id,
attributes: {
organization: data.organization_name,
endDate: data.is_current ? undefined : dateFormatMonthYear(data.end_date),
startDate: dateFormatMonthYear(data.start_date),
title: data.position_title,
},
html: asHTML(data.position_description),
html: asHTML(data.position_description) || '',
}));
return experiences;
};
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
{
"name": "next"
}
]
],
"strictNullChecks": true
},
"exclude": [
"node_modules"
Expand Down

0 comments on commit 0f32408

Please sign in to comment.