Why
The private iTunesListItem interface in fetchItunesItems is structurally identical to a subset of NotionMediaItem, so every caller must manually map NotionMediaItem fields to the narrower interface — a redundant transformation that the type system could eliminate.
Current state
io/itunes/fetchItunesItems.ts lines 9–13 define interface iTunesListItem { date: string; id: number; name: string }. app/likes/page.tsx maps NotionMediaItem to this interface at lines 24, 28, 32: i => ({ id: i.appleId, name: i.name, date: i.date }) — once per media category.
Ideal state
fetchItunesItems accepts NotionMediaItem[] directly (or a shared named subtype).
- The
appleId field is used without renaming inside the function.
- Callers pass items without hand-mapping fields; the per-category transformations at lines 24, 28, 32 are removed.
Starting points
io/itunes/fetchItunesItems.ts — lines 9–13 (the iTunesListItem interface) and the function signature
app/likes/page.tsx — lines 24, 28, 32 (the per-category mapping transformations to remove)
QA plan
- Open
io/itunes/fetchItunesItems.ts and verify the function signature accepts NotionMediaItem[] with no intermediate mapping type.
- Open
app/likes/page.tsx and verify the per-category i => ({ id: i.appleId, ... }) mappings are gone.
- Run
tsc --noEmit — expect no type errors.
Done when
fetchItunesItems accepts NotionMediaItem[] directly and no iTunesListItem interface or equivalent mapping transformation exists in the codebase.
Why
The private
iTunesListIteminterface infetchItunesItemsis structurally identical to a subset ofNotionMediaItem, so every caller must manually mapNotionMediaItemfields to the narrower interface — a redundant transformation that the type system could eliminate.Current state
io/itunes/fetchItunesItems.tslines 9–13 defineinterface iTunesListItem { date: string; id: number; name: string }.app/likes/page.tsxmapsNotionMediaItemto this interface at lines 24, 28, 32:i => ({ id: i.appleId, name: i.name, date: i.date })— once per media category.Ideal state
fetchItunesItemsacceptsNotionMediaItem[]directly (or a shared named subtype).appleIdfield is used without renaming inside the function.Starting points
io/itunes/fetchItunesItems.ts— lines 9–13 (theiTunesListIteminterface) and the function signatureapp/likes/page.tsx— lines 24, 28, 32 (the per-category mapping transformations to remove)QA plan
io/itunes/fetchItunesItems.tsand verify the function signature acceptsNotionMediaItem[]with no intermediate mapping type.app/likes/page.tsxand verify the per-categoryi => ({ id: i.appleId, ... })mappings are gone.tsc --noEmit— expect no type errors.Done when
fetchItunesItemsacceptsNotionMediaItem[]directly and noiTunesListIteminterface or equivalent mapping transformation exists in the codebase.