← スキル一覧に戻る

typescript-library
by mcclowes
A constraint and probability-based programming language
⭐ 1🍴 0📅 2026年1月12日
SKILL.md
name: typescript-library
prettier-ignore
description: Use when developing TypeScript npm packages including tsconfig, package.json exports, dual CJS/ESM builds, and publishing
TypeScript Library Development
Quick Start
// package.json
{
"name": "my-library",
"version": "1.0.0",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
"require": { "types": "./dist/index.d.cts", "default": "./dist/index.cjs" }
}
},
"files": ["dist"]
}
tsconfig.json Essentials
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "dist",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
},
"include": ["src"],
"exclude": ["**/*.test.ts"]
}
Key Practices
- Exports field: Required for proper ESM/CJS dual support
- Types first: In conditional exports,
typesmust come beforedefault - Files array: Only publish what's needed (dist, README, LICENSE)
- Declaration maps: Enable go-to-definition in consuming projects
- Peer dependencies: For frameworks/libraries users must also install
Publishing Checklist
- Update version in package.json
- Build:
npm run build - Test the package:
npm packand inspect tarball - Publish:
npm publish(ornpm publish --access publicfor scoped)
Common Tools
- tsup: Zero-config bundler for TypeScript libraries
- unbuild: Build system with automatic CJS/ESM
- changesets: Version management and changelogs
Reference Files
- references/tsconfig.md - tsconfig options explained
- references/exports.md - Package exports patterns
- references/publishing.md - npm publishing workflow
スコア
総合スコア
60/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です