-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtsconfig.json
More file actions
53 lines (47 loc) · 1.72 KB
/
tsconfig.json
File metadata and controls
53 lines (47 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{
"compilerOptions": {
// 🎯 目标环境 - ES2018 是最佳平衡点
"target": "ES2018", // Node 10+ 支持
"module": "ESNext", // 保持最新模块语法,让 tsup 处理
"lib": ["ES2018"], // Node.js 环境
// 📦 模块解析
"moduleResolution": "node", // Node.js 风格解析
"esModuleInterop": true, // 兼容 CommonJS 默认导出
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true, // 支持导入 JSON
"forceConsistentCasingInFileNames": true,
// 💎 类型检查 - 最严格但合理
"strict": true, // 开启所有严格检查
"noUnusedLocals": true, // 未使用的变量
"noUnusedParameters": true, // 未使用的参数
"noImplicitReturns": true, // 函数必须有返回值
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true, // 数组/对象访问安全
"exactOptionalPropertyTypes": false, // 精确可选属性
// 📁 输出配置
"declaration": true, // 生成 .d.ts
"declarationMap": true, // 生成 .d.ts.map
"sourceMap": true, // 生成 .js.map
"outDir": "./dist", // 输出目录
"rootDir": "./src", // 源码根目录
// ⚡ 性能优化
"incremental": true, // 增量编译
"skipLibCheck": true, // 跳过 .d.ts 检查
"isolatedModules": true, // 确保每个文件可独立编译
// 🛠️ 其他配置
"removeComments": false, // 保留注释(用于 JSDoc)
"allowJs": false, // 纯 TypeScript 项目
"importHelpers": true // 使用 tslib 优化
},
// 📂 文件配置
"include": ["src/**/*"],
"exclude": [
"node_modules",
"dist",
"coverage",
"**/*.test.ts",
"**/*.spec.ts",
"**/__tests__/**",
"**/__mocks__/**"
]
}