index-signature-alternatives
Installation
SKILL.md
Prefer More Precise Alternatives to Index Signatures
Overview
Index signatures are imprecise. Use interfaces, Records, or Maps instead.
Index signatures ({[key: string]: T}) allow any string key, don't require specific keys, and can't have different types for different keys. There are almost always better alternatives.
When to Use This Skill
- Defining types with known property names
- Modeling data from APIs or configuration files
- Working with CSV or dynamic data
- Choosing between object types and Maps