typescript-best-practices

Installation
SKILL.md

TypeScript Best Practices

TypeScript is more than just "JavaScript with types." It is a powerful structural type system that can provide profound safety if used correctly. This skill guides you through professional patterns and advanced type programming.

触发条件

  • 正在启动一个新的中大型 Web 项目(React/Vue/Node.js)。
  • 需要重构现有的 JS 代码库,并引入类型安全。
  • 正在开发一个面向外部开发者的 npm 包。
  • 需要在 monorepo 架构中管理跨项目的共享类型定义。
  • 团队代码库中充斥着大量的 anyas any,亟需纠正。

核心能力

1. 高级类型 (Advanced Types)

  • Conditional Types: 依据类型 T 的属性返回不同的类型 U 或 V(如 T extends U ? X : Y)。
  • Template Literal Types: 使用模板字符串语法操作字符串字面量类型。
  • Mapped Types: 基于现有类型生成新类型(如 Partial, Readonly, Record)。
  • Utility Types: 合理组合内置工具类,实现灵活的数据模型定义。
Installs
2
GitHub Stars
70
First Seen
Aug 18, 2026
typescript-best-practices — seaworld008/commonly-used-high-value-skills