---
name: type-safety-hardening
description: "Tightens types in a codebase: removes any, adds missing types and uses stricter settings step by step. Use to make TypeScript or Python types useful."
---

# Type safety hardening

Types only help if they are specific and enforced.

## How to work

1. Check the current compiler or checker settings and the error count.
2. Find loose spots: any, unknown casts, optional fields used as required.
3. Replace them with precise types, one module at a time.
4. Turn on one stricter option at a time and fix its errors.
5. Run the checker and tests after each step.

## Rules

- Do not silence errors with casts or ignore comments.
- Keep changes reviewable: small commits.

## Output

A plan, the changes, and the error count before and after.
