tsconfig 常用配置项(常用OR详解)
生成tsc配置文件方式
tsc --init
tsconfig.json
文件中指定了用来编译这个项目的根文件和编译选项。
tsconfig.json
文件可以是个空文件,那么所有默认的文件都会以默认配置选项编译
常用配置项总结
{
"compilerOptions": {
"outDir": "dist",
"sourceMap": true,
"target": "ES2016",
"module": "esnext",
"moduleResolution": "node",
"strict": true,
"jsx": "preserve",
"esModuleInterop": true,
"resolveJsonModule": true,
"lib": ["dom", "esnext"],
}
}
其他配置项搜集总结
{
"extends": "",
"compileOnSave": false,
"compilerOptions": {
"allowJS": false,
"checkJs": false,
"allowSyntheticDefaultImports": false,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"alwaysStrict": false,
"charset": "utf8",
"declaration": false,
"declarationDir": "",
"diagnostics": false,
"extendedDiagnostics": false,
"experimentalDecorators":false,
"disableSizeLimit": false,
"emitBOM": false,
"forceConsistentCasingInFileNames": false,
"incremental": true,
"isolatedModules":false,
"listEmittedFiles": false,
"listFiles": false,
"tsBuildInfoFile": "./buildFile",
"target": "ES5",
"module": "CommonJS",
"moduleResolution": "node",
"jsx":"Preserve",
"jsxFactory":"React.createElement",
"newLine": "crlf",
"noEmit": false,
"noEmitOnError": false,
"noErrorTruncation": false,
"noFallthroughCasesInSwitch": false,
"noImplicitAny": false,
"noImplicitReturns": false,
"noImplicitThis": false,
"noImplicitUseStrict": false,
"noLib": false,
"noResolve": false,
"noEmitHelpers": true,
"noStrictGenericChecks": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"lib": [
"DOM",
"ES2015",
"ScriptHost",
"ES2019.Array"
],
"outDir": "./dist",
"outFile": "./app.js",
"preserveSymlinks": false,
"preserveWatchOutput": false,
"removeComments": true,
"rootDir": "./",
"resolveJsonModule":true,
"emitDeclarationOnly": true,
"sourceMap": true,
"inlineSourceMap": false,
"inlineSources": false,
"declarationMap": true,
"types": [],
"typeRoots": [],
"importHelpers": true,
"downlevelIteration": true,
"strict": true,
"skipLibCheck": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"suppressExcessPropertyErrors": false,
"suppressImplicitAnyIndexErrors": false,
"strictBindCallApply": true,
"useDefineForClassFields": true,
"esModuleInterop": true,
"allowUmdGlobalAccess": true,
"baseUrl": "./",
"paths": {
"jquery": [
"node_modules/jquery/dist/jquery.min.js"
]
},
"rootDirs": [
"src",
"out"
],
},
"files": [],
"include": [],
"exclude": [],
"references": []
}