The generateTSVString function currently uses mutation (push) and imperative accumulation inside a forEach loop. There is also a TODO comment suggesting refactoring the logic to use map/reduce to avoid mutating tsvRows.
This issue proposes refactoring the function to:
Replace forEach + push with flatMap/map
Remove mutation-based accumulation
Eliminate the existing @ts-expect-error
Preserve the exact output format and behavior
This will improve readability, maintainability, and TypeScript safety without changing functionality.