Tooltip formatter の TypeScript 型エラーを修正

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Akira
2026-02-28 13:48:25 +09:00
parent 8931e4eb87
commit 3c888f0503

View File

@@ -214,7 +214,10 @@ export default function WeatherPage() {
domain={['auto', 'auto']}
/>
<Tooltip
formatter={(value: number | null) => value == null ? '—' : `${value.toFixed(1)}`}
formatter={(value: unknown) => {
if (value == null || typeof value !== 'number') return '—';
return `${value.toFixed(1)}`;
}}
/>
<Legend />
<Line
@@ -266,8 +269,8 @@ export default function WeatherPage() {
tickFormatter={(v) => `${v}h`}
/>
<Tooltip
formatter={(value: number | null, name: string) => {
if (value == null) return '—';
formatter={(value: unknown, name: unknown) => {
if (value == null || typeof value !== 'number') return '—';
return name === '降水量' ? `${value} mm` : `${value} h`;
}}
/>