{ "compilerOptions": { // 基础配置 "target": "ESNext", // 编译目标 "module": "ESNext", // 模块系统 "lib": ["ESNext"], // 引用的库 "moduleResolution": "bundler", // 模块解析策略 // 输出配置 "rootDir": "./src", // 源代码根目录 "outDir": "./dist", // 输出目录 "sourceMap": false, // 不生成 source map (生产环境不需要) "declaration": false, // 不生成 .d.ts 文件 (生产环境不需要) "removeComments": true, // 移除注释(减小体积) "newLine": "lf", // 换行符统一为 LF // 模块解析 "baseUrl": "./", // 基础路径 "paths": { "@/*": ["src/*"] // 路径别名 }, "esModuleInterop": true, // ESM 互操作性 "allowSyntheticDefaultImports": true, // 允许合成默认导入 "resolveJsonModule": true, // 允许导入 JSON "forceConsistentCasingInFileNames": true, // 强制文件名大小写一致 // 类型检查 - 严格模式 "strict": true, // 启用所有严格检查 "noImplicitAny": true, // 禁止隐式 any "strictNullChecks": true, // 严格空值检查 "strictFunctionTypes": true, // 严格函数类型 "strictBindCallApply": true, // 严格 bind/call/apply "strictPropertyInitialization": true, // 严格属性初始化 "noImplicitThis": true, // 禁止隐式 this "alwaysStrict": true, // 始终严格模式 // 额外检查 - 放宽以适配现有代码 "noUnusedLocals": false, // 允许未使用的局部变量(与 oxlint 配合) "noUnusedParameters": false, // 允许未使用的参数(与 oxlint 配合) "noImplicitReturns": false, // 允许部分代码路径无返回值 "noFallthroughCasesInSwitch": true, // 禁止 switch 穿透 "noUncheckedIndexedAccess": false, // 放宽索引访问检查 "noImplicitOverride": false, // 放宽 override 修饰符要求 "useUnknownInCatchVariables": false, // catch 变量使用 any // 装饰器支持 (NestJS 需要) "experimentalDecorators": true, "emitDecoratorMetadata": true, // 关闭 verbatimModuleSyntax 以允许 NestJS 依赖注入需要的运行时类型信息 "verbatimModuleSyntax": false, "skipLibCheck": true, // 跳过库文件类型检查(加快编译) "isolatedModules": true, // 每个文件作为独立模块 "allowJs": false, // 不允许 JS 文件(纯 TS 项目) "checkJs": false, // 不检查 JS 文件 "types": ["node", "vite/client"] // 包含 Node.js 和 Vite 类型 }, // 包含和排除 "include": ["src/**/*", "mikro-orm.config.ts"], "exclude": ["node_modules", "dist", "test", "**/*.spec.ts", "**/*.test.ts", "src/src/**/*"] }