mm
This commit is contained in:
@@ -1,73 +1,7 @@
|
||||
{
|
||||
// 本文件仅供 TS Server 检查语法,不负责编译,编译使用的是另一个文件 tsconfig.build.json
|
||||
|
||||
// TS 类型检查专用配置, build 配置继承后按需覆盖。
|
||||
"compilerOptions": {
|
||||
// 编译后, 输出的语法格式,自从 2026 年后,cjs 模块也能识别 es 模块了,如果需要兼容老项目则调低版本
|
||||
"target": "es2023",
|
||||
// 前端用 esnext ,后端用 nodenext ,node 其实也是用 js 写的一个库,前端是不带这个库的
|
||||
"module": "esnext",
|
||||
// 所有项目必须开,兼容 es 和 cjs 导入,允许 import React from 'react' ,而非 import * as React 。
|
||||
"esModuleInterop": true,
|
||||
// 允许导入 ts,tsx 扩展名。
|
||||
"allowImportingTsExtensions": true,
|
||||
// 允许导入 js,jsx 扩展名。
|
||||
"allowJs": true,
|
||||
// 允许导入 json 模块,而不只是 ts,js,css 。
|
||||
"resolveJsonModule": true,
|
||||
// 启用装饰器,也就是 @XXX 注解。
|
||||
"experimentalDecorators": true,
|
||||
// 发射装饰器元数据。
|
||||
"emitDecoratorMetadata": true,
|
||||
// 转换 jsx 时,使用 17+ 的新语法导入 react 。
|
||||
"jsx": "react-jsx",
|
||||
// 可作被其他项目引用源码,但有潜在的 ts 版本问题,建议使用 workspace dep 模式,而不是写 references 。
|
||||
"composite": false,
|
||||
// 只加载指定类型的声明包,避免加载无用类型,提升编译速度
|
||||
"types": ["node", "vite/client"],
|
||||
// 不输出编译后的文件,也就是 dist 目录下为空, 本文件只做类型检查。
|
||||
"noEmit": true,
|
||||
// 开启严格类型检查模式,只需开启这一个,其他的等于都开启了,要注意这只是类型检查,而非语法检查。
|
||||
"strict": true,
|
||||
// 让 TS 编译器保留用于注解的 import 语句,不要优化掉,后面 babel 转义器要用。
|
||||
"verbatimModuleSyntax": true,
|
||||
// 跳过第三方库的类型检查,加快编译速度,减少30% 。
|
||||
"skipLibCheck": true,
|
||||
// 跳过内置库的类型检查,加快编译速度,分钟级降至秒级。
|
||||
"skipDefaultLibCheck": true,
|
||||
// 增量编译,加快编译速度,尤其是大项目。
|
||||
"incremental": true
|
||||
},
|
||||
// 本配置文件的作用范围,包含根目录下的一切文件,包括 vite.config.ts 等配置文件
|
||||
"include": ["**/*.ts", "*/*.tsx"],
|
||||
// 本配置文件排除的范围。
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"dist",
|
||||
".turbo/**/*",
|
||||
".cache/**/*",
|
||||
".vite/**/*",
|
||||
"vite.config.ts",
|
||||
"*.config.ts",
|
||||
"*.config.js",
|
||||
"tsconfig.*.json",
|
||||
"__tests__/**/*",
|
||||
"test/**/*",
|
||||
"tests/**/*",
|
||||
"**/*.test.ts",
|
||||
"**/*.test.tsx",
|
||||
"**/*.spec.ts",
|
||||
"**/*.spec.tsx",
|
||||
".storybook/**/*",
|
||||
"stories/**/*",
|
||||
"example/**/*",
|
||||
"examples/**/*",
|
||||
"scripts/**/*",
|
||||
".env",
|
||||
".env.*",
|
||||
"public/**/*",
|
||||
"docs/**/*",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./tsconfig.app.json" },
|
||||
{ "path": "./tsconfig.node.json" }
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user