typescript-interface-vs-type
Installation
SKILL.md
TypeScript: Interface vs Type
Goal
Use interface until type features are needed.
Prefer readable errors and compiler performance.
Rules
- Use
interfacefor object type definitions. - Use
interface extendsfor extending object shapes. - Use
interfacefor class contracts. - Use
typefor unions, tuples, primitives, mapped types, conditional types, and function aliases. - Prefer
interface extendsover object intersections. - Avoid intersections when properties may conflict.