Skip to content

Commit

Permalink
Simplify types
Browse files Browse the repository at this point in the history
This forces the email arrays to be just `string[]` instead of
`string[] | null`, which makes handling types easier.
  • Loading branch information
mvandenburgh committed Jul 26, 2024
1 parent ae68462 commit a5741dd
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions web/src/views/DandisetLandingView/ContactDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const store = useDandisetStore();
const currentDandiset = computed(() => store.dandiset);
const dandisetOwnerEmails = computed(() => store.owners?.map((owner: User) => owner.email));
const dandisetOwnerEmails = computed(() => store.owners?.map((owner: User) => owner.email) || []);
const dandisetContactPersonEmails = computed(() =>
currentDandiset.value?.metadata?.contributor?.filter(
Expand All @@ -113,12 +113,10 @@ const dandisetContactPersonEmails = computed(() =>
.filter((email?: Email) => email !== undefined)
// Exclude users with an empty email
.filter((email: Email) => email !== '')
|| []
);
const makeTemplate = (contacts: string[] | undefined) => {
if (contacts === undefined) {
throw new Error('Contact is undefined.');
}
const makeTemplate = (contacts: string[]) => {
if (currentDandiset.value === undefined) {
throw new Error('Dandiset is undefined.');
}
Expand Down

0 comments on commit a5741dd

Please sign in to comment.