Skip to content

Commit 8d0669c

Browse files
committed
Fix typing issues
1 parent b28bf56 commit 8d0669c

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

app/src/views/PerExport/index.tsx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,20 @@ export function Component() {
212212
),
213213
);
214214

215-
const topFiveRatedComponents = topRatedComponents.filter(
216-
(component) => isDefined(component.rating),
217-
).slice(0, 5);
215+
const topFiveRatedComponents = topRatedComponents.map(
216+
(component) => {
217+
const { rating } = component;
218+
219+
if (isNotDefined(rating)) {
220+
return undefined;
221+
}
222+
223+
return {
224+
...component,
225+
rating,
226+
};
227+
},
228+
).filter(isDefined).slice(0, 5);
218229

219230
// FIXME: let's use avgSafe
220231
function getAverage(list: number[]) {
@@ -486,9 +497,12 @@ export function Component() {
486497
>
487498
{assessmentStats.topFiveRatedComponents.map(
488499
(component) => (
489-
<div className={styles.topRatedComponent} key={component.ra}>
500+
<div
501+
className={styles.topRatedComponent}
502+
key={component.rating.id}
503+
>
490504
<div className={styles.label}>
491-
{component.rating?.title}
505+
{component.rating.title}
492506
</div>
493507
<div>
494508
{getFormattedComponentName(component.details)}

app/src/views/ThreeWActivityDetail/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export function Component() {
133133
date: (
134134
<DateOutput
135135
value={modifiedAt}
136-
/> ?? '?'
136+
/>
137137
),
138138
user: getUserName(modifiedBy),
139139
},

0 commit comments

Comments
 (0)