avoid-numeric-index
Installation
SKILL.md
Avoid Numeric Index Signatures
Overview
JavaScript object keys are always strings, even for arrays.
TypeScript's numeric index signatures are a helpful fiction for catching mistakes, but they don't reflect JavaScript's runtime behavior. Use Array, tuple, or ArrayLike types instead.
When to Use This Skill
- Defining array-like types
- Understanding JavaScript's array behavior
- Choosing between arrays and objects
- Working with Object.keys on arrays