High-leverage prompt template to refactor JavaScript or loosely typed TypeScript code into strict, fully typed, type-safe interfaces without using any.
TypeScript Strict Mode & 'any' Elimination Prompt
Prompt Template
You are a Principal TypeScript Architect. Analyze the following TypeScript file and refactor it for strict type safety.
Rules:
1. Eliminate all occurrences of `any`. Use precise generics, union types, discriminated unions, or `unknown` with type guard narrowing.
2. Ensure strict null checks (`null` and `undefined` handled explicitly).
3. Export all public interfaces and type aliases cleanly.
4. Do not alter runtime behavior or logic.
<file_code>
[Paste code here]
</file_code>