AGENT SKILL
typescript
Typed JavaScript.
- License 许可
- MIT
- 所属仓库
- dhaupin/vant
- 最近更新
- 2026-11-13
- Stars
- ★ 16
- Forks
- 1
01 前言 Front Matter
- name
- typescript
- license
- MIT
- metadata
- { "author": "vant", "version": "1.0" }
- description
- Typed JavaScript.
03 SKILL.md 正文
TypeScript
Typed JavaScript.
When To Use
- Type safety needed
- Large codebases
- Modern JS projects
What To Do
1. Types
interface User {
id: number
name: string
email?: string // optional
}
function getUser(id: number): User {
return { id, name: 'User' }
}
2. Generics
function first<T>(arr: T[]): T {
return arr[0]
}
3. Compile
npx tsc --init
npx tsc
npx tsc --watch
4. Config
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"strict": true
}
}
Role: TypeScript Developer Input: .ts files Output: .js files
Typed JS.
04 同仓库更多 Skills
yaml
Data serialization.
★ 16
vite
Frontend build tool.
★ 16
test-unit
Test individual functions and methods in isolation. Test happy path, edge cases, and error handling. Use when adding new functions, after bug fixes, or before commits.
★ 16
test-snapshot
Capture and compare UI/component snapshots to detect visual changes. Use when testing UI rendering, before visual changes, or for design systems.
★ 16
test-smoke
Quick sanity check to verify basic functionality works. Run fastest tests first. Use when needing quick verification before deeper testing.
★ 16
test-regression
Verify no new bugs introduced since last release. Run full test suite against changes. Use when checking for regressions or before releases.
★ 16