Skip to content

Commit 2760ad6

Browse files
fix: resolve TypeScript strict mode violations in ProfileMenu MainSection
Fix two strict violations in ProfileMenu/sections/MainSection.tsx introduced by the main branch merge: - Access user?.username safely since user can be undefined - Replace .filter(Boolean) with type predicate to narrow array type correctly Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 1a9f240 commit 2760ad6

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

packages/shared/src/components/ProfileMenu/sections/MainSection.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import type { ReactElement } from 'react';
33

44
import { ProfileSection } from '../ProfileSection';
5+
import type { ProfileSectionItemProps } from '../ProfileSectionItem';
56
import {
67
AnalyticsIcon,
78
CoinIcon,
@@ -22,7 +23,7 @@ export const MainSection = (): ReactElement => {
2223
items={[
2324
{
2425
title: 'Your profile',
25-
href: `${webappUrl}${user.username}`,
26+
href: `${webappUrl}${user?.username}`,
2627
icon: UserIcon,
2728
},
2829
hasAccessToCores && {
@@ -32,7 +33,7 @@ export const MainSection = (): ReactElement => {
3233
},
3334
{
3435
title: 'Achievements',
35-
href: `${webappUrl}${user.username}/achievements`,
36+
href: `${webappUrl}${user?.username}/achievements`,
3637
icon: MedalBadgeIcon,
3738
},
3839
{
@@ -45,7 +46,7 @@ export const MainSection = (): ReactElement => {
4546
href: `${webappUrl}analytics`,
4647
icon: AnalyticsIcon,
4748
},
48-
].filter(Boolean)}
49+
].filter((item): item is ProfileSectionItemProps => !!item)}
4950
/>
5051
);
5152
};

0 commit comments

Comments
 (0)