Files
nuzlocke-tracker/.beans/archive/nuzlocke-tracker-d5ht--bug-typescript-build-fails-due-to-optional-propert.md

39 lines
1.7 KiB
Markdown
Raw Normal View History

2026-03-20 16:39:52 +01:00
---
# nuzlocke-tracker-d5ht
title: 'Bug: TypeScript build fails due to optional property type mismatches in journal components'
status: completed
2026-03-20 16:39:52 +01:00
type: bug
priority: high
tags:
- failed
2026-03-20 16:39:52 +01:00
created_at: 2026-03-20T15:39:00Z
updated_at: 2026-03-20T19:17:34Z
2026-03-20 16:39:52 +01:00
parent: nuzlocke-tracker-bw1m
---
The frontend TypeScript build fails with 3 errors due to `exactOptionalPropertyTypes` being enabled.
## Errors
1. `JournalEntryPage.tsx:76` - `bossResults` and `bosses` props passed as `undefined` to `JournalEditor`
2. `JournalEntryPage.tsx:92` - `bossResult` and `boss` props passed as `undefined` to `JournalEntryView`
3. `RunEncounters.tsx:1170` - `bossResults` and `bosses` props passed as `undefined` to `JournalSection`
## Root Cause
Optional props in interfaces are declared as `prop?: Type` but callers pass `undefined` values from React Query hooks. With `exactOptionalPropertyTypes: true`, TypeScript requires `prop?: Type | undefined` to allow explicit `undefined` values.
## Fix
Update the interfaces in these files:
- `JournalEditor.tsx` lines 9-10: change to `bossResults?: BossResult[] | undefined` and `bosses?: BossBattle[] | undefined`
- `JournalEntryView.tsx` lines 8-9: change to `bossResult?: BossResult | null | undefined` and `boss?: BossBattle | null | undefined`
- `JournalSection.tsx` lines 9-10: change to `bossResults?: BossResult[] | undefined` and `bosses?: BossBattle[] | undefined`
## Summary of Changes
TypeScript build errors fixed by adding `| undefined` to optional property types in journal components:
- `JournalEditor.tsx`: `bossResults` and `bosses` props
- `JournalEntryView.tsx`: `bossResult` and `boss` props
- `JournalSection.tsx`: `bossResults` and `bosses` props