typescript
Use when writing or reviewing TypeScript type design, generics, module resolution, or compiler configuration. Do not use when the work is JavaScript runtime debugging or framework-specific UI composition.
- License 许可
- MIT
- 最近更新
- 2026-10-08
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- typescript
- license
- MIT
- metadata
- { "owner": "Harley Bartles", "scope": "TypeScript type design, generics, module resolution, and compiler configuration.", "status": "active", "use_when": [ "writing or reviewing TypeScript type design.", "working with generics, mapped types, or conditional types.", "resolving module paths or configuring tsconfig.json.", "narrowing types or writing type guards." ], "source-id": "typescript", "source-path": "skills/typescript/SKILL.md", "do_not_use_when": [ "the work is JavaScript runtime debugging.", "the work is framework-specific UI composition." ], "provenance-name": "Typescript first-party skill", "source-category": "first_party" }
- description
- Use when writing or reviewing TypeScript type design, generics, module resolution, or compiler configuration. Do not use when the work is JavaScript runtime debugging or framework-specific UI composition.
02 资源文件 5
- 参考文档agents/openai.yaml431 B
- 资产文件assets/authority/authority.yaml1.1 KB
- 资产文件assets/authority/CITATIONS.md948 B
- 资产文件assets/authority/source-map.yaml456 B
- 参考文档references/operational-guidance.md2.5 KB
03 SKILL.md 正文
TypeScript
Overview
TypeScript adds a static type system to JavaScript. This skill covers type design, generics, module resolution, and compiler configuration so code stays safe and maintainable.
When to Use
- Designing interfaces, type aliases, unions, intersections, or literal types.
- Writing or consuming generic functions and types.
- Narrowing types with guards,
typeof,instanceof, or discriminated unions. - Authoring declaration files or configuring project-wide
tsconfig.json. - Choosing module resolution strategy and strictness settings.
Do not use for runtime behavior, build tooling unrelated to types, or framework-specific component composition.
Core Pattern
- Model data with
interfaceortypebefore writing logic. - Use generics only when the function or type must work across multiple concrete types; add constraints.
- Let inference do the work; add annotations at module boundaries and public APIs.
- Prefer
unknownoverany; narrow with type guards before use. - Keep
strictandnoImplicitAnyenabled; alignmodule,moduleResolution, andtargetwith the runtime.
Common Mistakes
- Overusing
anyinstead ofunknownor precise unions. - Declaring generic parameters without constraints, leading to impossible operations.
- Mixing
interfaceextension andtypealiases for the same shape inconsistently. - Misaligned
tsconfig.jsonpaths or module resolution causing hidden import errors. - Disabling strict settings to silence errors instead of fixing the underlying type issue.
04 同仓库更多 Skills
writing
Use when drafting, revising, or reviewing prose for human readers and clarity, an authorised voice, or reader-fatigue concerns may interact.
writing-with-clarity
Use when drafting, revising, or reviewing prose intended for human readers, including documentation, README files, reports, explanations, UI copy, errors, comments, commit messages, and pull request text.
writing-style
Use when revising or reviewing human-facing prose against an authorised voice card or a contextual reader-fatigue profile.
skill
暂无简介
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment.
writing-roadmaps
Use when a goal is too large for one writing-plans plan and requires a sequenced roadmap of consecutive plans.