hookehuyr

📃 docs: 注释tsconfig

1 { 1 {
2 "compilerOptions": { 2 "compilerOptions": {
3 - "outDir": "./", 3 + /* 基本选项 */
4 - "target": "esnext", 4 + "target": "esnext", // 指定 ECMAScript 目标版本: 'ES3' (default), 'ES5', 'ES6'/'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'
5 - "module": "CommonJS", 5 + "module": "CommonJS", // 指定使用模块: 'commonjs', 'amd', 'system', 'umd' or 'es2015'
6 - "strict": true, 6 + "lib": [ // 指定要包含在编译中的库文件
7 - "jsx": "preserve", 7 + "esnext",
8 - "importHelpers": true, 8 + "dom",
9 - "moduleResolution": "node", 9 + "dom.iterable",
10 - "esModuleInterop": true, 10 + "scripthost"
11 - "allowSyntheticDefaultImports": true, 11 + ],
12 - "sourceMap": true, 12 + "allowJs": true, // 允许编译 javascript 文件
13 - "isolatedModules": false, 13 + // "checkJs": true, // 报告 javascript 文件中的错误
14 - "baseUrl": ".", 14 + "jsx": "preserve", // 指定 jsx 代码的生成: 'preserve', 'react-native', or 'react'
15 - "allowJs": true, 15 + // "declaration": true, // 生成相应的 '.d.ts' 文件
16 - // "checkJs": true, 16 + // "sourceMap": true, // 生成相应的 '.map' 文件
17 - "types": [ 17 + // "outFile": "./", // 将输出文件合并为一个文件
18 + "outDir": "./", // 指定输出目录
19 + // "rootDir": "./", // 用来控制输出目录结构 --outDir.
20 + "removeComments": true, // 删除编译后的所有的注释
21 + // "noEmit": true, // 不生成输出文件
22 + "importHelpers": true, // tslib 导入辅助工具函数
23 + "isolatedModules": false, // 将每个文件做为单独的模块 (与 'ts.transpileModule' 类似)
24 +
25 + /* 严格的类型检查选项 */
26 + "strict": true, // 启用所有严格类型检查选项
27 + // "noImplicitAny": true, // 在表达式和声明上有隐含的 any类型时报错
28 + // "strictNullChecks": true, // 启用严格的 null 检查
29 + // "noImplicitThis": true, // this 表达式值为 any 类型的时候,生成一个错误
30 + // "alwaysStrict": true, // 以严格模式检查每个模块,并在每个文件里加入 'use strict'
31 +
32 + /* 额外的检查 */
33 + "noUnusedLocals": true, // 有未使用的变量时,抛出错误
34 + "noUnusedParameters": true, // 有未使用的参数时,抛出错误
35 + "noImplicitReturns": true, // 并不是所有函数里的代码都有返回值时,抛出错误
36 + "noFallthroughCasesInSwitch": true, // 报告 switch 语句的 fallthrough 错误。(即,不允许 switch case 语句贯穿)
37 +
38 + /* 模块解析选项 */
39 + "moduleResolution": "node", // 选择模块解析策略: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)
40 + "baseUrl": ".", // 用于解析非相对模块名称的基目录
41 + "paths": { // 模块名到基于 baseUrl 的路径映射的列表
42 + "@/*": [
43 + "src/*"
44 + ]
45 + },
46 + // "rootDirs": [], // 根文件夹列表,其组合内容表示项目运行时的结构内容
47 + // "typeRoots": [], // 包含类型声明的文件列表
48 + "types": [ // 需要包含的类型声明文件名列表
18 // "webpack-env", 49 // "webpack-env",
19 "vite/client", 50 "vite/client",
20 "lodash", 51 "lodash",
...@@ -22,17 +53,19 @@ ...@@ -22,17 +53,19 @@
22 "node", 53 "node",
23 "jquery", 54 "jquery",
24 ], 55 ],
25 - "paths": { 56 + "allowSyntheticDefaultImports": true, // 允许从没有设置默认导出的模块中默认导入。
26 - "@/*": [ 57 +
27 - "src/*" 58 + /* Source Map Options */
28 - ] 59 + // "sourceRoot": "./", // 指定调试器应该找到 TypeScript 文件而不是源文件的位置
29 - }, 60 + // "mapRoot": "./", // 指定调试器应该找到映射文件而不是生成文件的位置
30 - "lib": [ 61 + // "inlineSourceMap": true, // 生成单个 sourcemaps 文件,而不是将 sourcemaps 生成不同的文件
31 - "esnext", 62 + // "inlineSources": true, // 将代码与 sourcemaps 生成到一个文件中,要求同时设置了 --inlineSourceMap --sourceMap 属性
32 - "dom", 63 +
33 - "dom.iterable", 64 + /* 其他选项 */
34 - "scripthost" 65 + // "experimentalDecorators": true, // 启用装饰器
35 - ] 66 + // "emitDecoratorMetadata": true, // 为装饰器提供元数据的支持
67 +
68 + "esModuleInterop": true, // 可以在es6中导入commonjs
36 }, 69 },
37 "include": [ 70 "include": [
38 "src/**/*" 71 "src/**/*"
......