fix: TypeScript null safety fixes for strict mode

- RateAnalysis: null guard on price_incl in timeline trace
- Layout: explicit null check on alertCount, use ?? for user.name

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-05 12:18:38 +00:00
parent ebbffa3137
commit 8948d3abf6
2 changed files with 3 additions and 3 deletions

View file

@ -39,7 +39,7 @@ export default function Layout({ children }: { children: ReactNode }) {
<NavLink key={to} to={to} className={({ isActive }) => isActive ? 'active' : ''}> <NavLink key={to} to={to} className={({ isActive }) => isActive ? 'active' : ''}>
<Icon {...ICON} /> <Icon {...ICON} />
{label} {label}
{to === '/market' && alertCount ? ( {to === '/market' && alertCount != null && alertCount > 0 ? (
<span style={{ <span style={{
marginLeft: 'auto', background: 'var(--danger)', color: '#fff', marginLeft: 'auto', background: 'var(--danger)', color: '#fff',
borderRadius: 10, fontSize: 10, fontWeight: 700, borderRadius: 10, fontSize: 10, fontWeight: 700,
@ -49,7 +49,7 @@ export default function Layout({ children }: { children: ReactNode }) {
</NavLink> </NavLink>
))} ))}
</nav> </nav>
<div className="sidebar-user">{user.name || user.email}</div> <div className="sidebar-user">{user.name ?? user.email}</div>
</aside> </aside>
<header className="top-bar"> <header className="top-bar">

View file

@ -354,7 +354,7 @@ function buildTimelineTraces(entries: TimelineEntry[]) {
mode: 'lines+markers' as const, mode: 'lines+markers' as const,
name: room, name: room,
x: pts.map(p => p.scraped_at), x: pts.map(p => p.scraped_at),
y: pts.map(p => p.price_incl), y: pts.map(p => p.price_incl ?? null),
line: { color: colors[i % colors.length], width: 2 }, line: { color: colors[i % colors.length], width: 2 },
marker: { size: 5, color: colors[i % colors.length] }, marker: { size: 5, color: colors[i % colors.length] },
hovertemplate: `${room}: £%{y:.2f}<extra></extra>`, hovertemplate: `${room}: £%{y:.2f}<extra></extra>`,