tsconfig
一句话解释
tsconfig.JSON 是配置 file 那个 tells TypeScript 编译器如何 编译: 目标, strictness, 模块系统, file inclusion/exclusion, and 更多.
用大白话说
tsconfig.json is the control center for a TypeScript project. It specifies compiler options like the JavaScript target version, strictness level, module system, output directory, and which files to include or exclude.
Key options include: 目标 (e.g., ES2020), strict (enables all strict checks), 模块 (e.g., ESNext), outDir (output directory), rootDir (source directory), lib (available APIs), and paths (path aliases).
Without tsconfig.json, the compiler uses default settings. Every TypeScript project should have one. It is also used by IDEs and build tools to understand the project structure.
示例
{
"compilerOptions": {
"target": "ES2022",
"strict": true,
"module": "ESNext",
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src/**/*"]
}typical tsconfig.JSON 使用 strict 模式, ES2022 目标, and src-到-dist compilation.
相关术语
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。