What problem does it solve?
This Skill provides guidance and best practices for writing clean, maintainable, and testable TypeScript code, particularly within a web development context.
Core Features & Use Cases
- Dependency Injection: Learn how to explicitly pass dependencies through constructors for better testability and clarity.
- DOM Element Ownership: Understand how to manage the lifecycle and parentage of DOM elements to prevent conflicts.
- Early Return Pitfalls: Avoid silent failures by understanding the implications of early returns when elements are not found.
- Safe DOM Manipulation: Strategies for interacting with the DOM to prevent index-based errors and ensure robustness.
- Use Case: When refactoring a complex JavaScript application to TypeScript, use this Skill to ensure new modules adhere to best practices for dependency management and DOM interaction.
Quick Start
Follow the guidelines in this skill to refactor the constructor of your Selection class to accept editorElement as a parameter.