Team Culture to Prevent any Creep
What you'll learn: How code review practices, linting rules, and documentation create a team culture that discourages casual any usage.
Why Culture Matters More Than Rules
You can enable noImplicitAny and audit your codebase, but preventing any creep long-term requires human habits, not just compiler flags. One developer adding an any to "unblock" a feature can create a permission structure where others feel it's acceptable. Soon, type safety erodes through social norms, not technical failure.
Code Review as the Front Line
Make any visible in reviews. Many teams adopt a rule: any pull request introducing any requires explicit justification in the PR description. Reviewers ask:
- "Can this be
unknowninstead?" - "Can we constrain this with a generic?"
- "Is this temporary? Add a TODO with a ticket."
The goal isn't to ban any absolutely—it's to make it deliberate rather than reflexive.
Linting Rules That Enforce Standards
ESLint's TypeScript plugin offers rules like @typescript-eslint/no-explicit-any that flag every any usage. Configure it as a warning (not error) during migration, error once baseline is clean. Some teams allow any only in specific directories (like src/legacy/) using override rules.
Documentation and Shared Guidelines
A team style guide should include:
- When
anyis acceptable (third-party integrations, rapid prototyping) - Preferred alternatives (
unknown, generics, union types) - Migration strategies for existing
anycode
Include examples in onboarding docs. New developers learn the standard before writing their first line.
Key takeaway: Preventing any creep requires code review discipline, automated linting, and documented standards—technical tools only work when the team culture values type safety collectively.