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