-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtsconfig.json
46 lines (44 loc) · 2.08 KB
/
tsconfig.json
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
{
"compilerOptions": {
"noImplicitAny": true, // 不允许隐式的any类型
"noImplicitThis": true, // 不允许this的类型为any
"strictNullChecks": true, // 启用严格的null检查(推荐开启)
"resolveJsonModule": true, // 允许导入.json文件
"experimentalDecorators": true, // 启用实验性的装饰器
"emitDecoratorMetadata": true,
"moduleResolution": "node", // 模块解析策略
"module": "esnext", // 模块系统,esnext 通常用于现代打包工具
"target": "esnext",
"outDir": "test-ui",
"declaration": true, // 生成.d.ts文件
"sourceMap": true,
"lib": ["esnext", "dom", "dom.iterable", "scripthost"],
"allowSyntheticDefaultImports": true, // 允许从没有默认导出的模块中默认导入
"baseUrl": "./",
"paths": {
"@": ["src"]
},
"jsx": "preserve", // 保留JSX,不转换为JavaScript
"jsxFactory": "h", // JSX工厂函数,用于Vue 3等框架
"jsxFragmentFactory": "h.f", // JSX Fragment工厂函数
"allowJs": true, // 通常不建议在TypeScript项目中允许JavaScript文件(除非有特殊需求)
"checkJs": true, // 不检查.js文件(除非allowJs为true)
"downlevelIteration": true,
"esModuleInterop": true, // 允许 export = 导出,由import from 导入
"removeComments": true, // 移除注释
"allowImportingTsExtensions": true,
"isolatedModules": true, // 设置为true时,每个文件都将被视为单独的编译单元
"noEmit": true,
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"useDefineForClassFields": true,
"skipLibCheck": true
},
"exclude": ["**/*.jsx", "**/**/_usage/*", "**/**/__tests__/*", "node_modules", "src/_common", "dist", "lib", "esm", "cjs", "es"],
"include": ["src", "typings.d.ts"],
"types": ["node", "vitest/globals"], // 引入额外的全局类型定义
"compileOnSave": false, // 不在保存时自动编译TypeScript文件(通常由构建工具处理)
"references": [{ "path": "./tsconfig.node.json" }]
}