Prompt file imported from chikamsoachumsft/Hackathon-Excercise (
.github/prompts/refactor-legacy.prompt.md). Fill in{{module}}before use. Copyright stays with the author.
Refactor {{module}}.
Requirements:
- FIRST write characterization tests that capture current behavior, then refactor.
- Remove
anytypes; give the module precise TypeScript types. - Replace unsafe constructs (no
eval). - Fix obvious performance problems (e.g. O(n²) joins → index once).
- Keep behavior identical;
npm testandnpm run typecheckmust stay green.
Show the before/after complexity and the passing test output.