This commit is contained in:
2026-05-07 02:15:20 +08:00
parent da0a6d0f81
commit ccc46844b6
141 changed files with 2358 additions and 1661 deletions
+2 -64
View File
@@ -1,74 +1,12 @@
{
// 此文件仅用于类型检查,不用于类型检查,构建时会指定使用 tsconfig.build.json
"extends": "./tsconfig.base.json",
"compilerOptions": {
// Browser api,需要加 "DOM","DOM.Iterable"
// Node api,需要加 "ES2025",始终使用带版本号的最新版本
// NextJs api,属于同构,server 端会预处理 DOM,计算url,三个都需要 "ES2025", "DOM", "DOM.Iterable"
"lib": ["ES2025", "DOM", "DOM.Iterable"],
/**
* 显式声明使用的类型包
* - node:Node.js API
* - react:JSX / React 类型
* - vite/client:import.meta / env
*/
"types": ["node", "react"],
/**
* React JSX 编译模式
* - 使用 React 17+ 新 JSX Transform
* - 不需要手动 import React
*/
"jsx": "react-jsx",
/**
* 编译输出目录
* - tsc / tsc -b 都会用到
*/
"outDir": "./dist",
/**
* 源码根目录
* - 确保 dist 结构与 src 一致
* - 对 declaration 路径至关重要
*/
"rootDir": "./src",
/**
* 生成 .d.ts 类型声明文件
* - 组件库 / npm 包发布必需
* - 对应用项目无害,仅影响类型输出
*/
"declaration": true,
/**
* 只做类型检查,不生成 JS 输出
* - 适用于 Vite / Next / Nuxt 等 bundler 场景
* - 防止 tsc 与构建工具重复 emit
*/
"noEmit": true,
/**
* 强制单文件可独立编译
* - 适配 esbuild / SWC / bundler 编译模型
* - 禁止依赖跨文件类型推断(enum / namespace 等)
*/
"isolatedModules": true
"jsx": "react-jsx",
"declaration": true
},
/**
* 参与类型检查和编译的文件
* - 只扫描 src
* - 其它目录通过 exclude 排除
*/
"include": ["src"],
/**
* 明确排除非源码内容
* - 避免污染类型系统
* - 防止误入 dist / test / config
* - 保证发布包干净
*/
"exclude": [
"node_modules",
"dist",