avoid-numeric-index

Community

Avoid numeric index signatures in TypeScript.

Authorluyi985
Version1.0.0
Installs0

System Documentation

What problem does it solve?

JavaScript's runtime keys are always strings, while TypeScript supports number-index signatures as a compile-time fiction. This Skill guides developers to avoid { [n: number]: T } and choose Array<T>, tuple, ArrayLike<T>, or Map<number, T> when modeling collections.

Core Features & Use Cases

  • Understand the runtime behavior of object keys and why numeric indices are not real indices at runtime.
  • Learn when to prefer arrays, tuples, ArrayLike<T>, or Map<number, T> over numeric index signatures in type definitions.
  • Apply guidance to common scenarios like modeling sequences, fixed-length data, and keyed collections that rely on numeric keys.

Quick Start

Replace any numeric index signature with an Array or Map in your TypeScript types and verify runtime key behavior.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: avoid-numeric-index
Download link: https://github.com/luyi985/lyi-bash/archive/main.zip#avoid-numeric-index

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.