当前位置:网站首页>Tsconfig of typescript TS basics JSON configuration options
Tsconfig of typescript TS basics JSON configuration options
2022-07-07 21:45:00 【Tangtang 246】
tsc xxx.ts // compile xxx.ts file
tsc xxx.ts -w // Compile and monitor xxx.ts file
tsc // Compile all ts file , The premise is that there is tsconfig.json
tsc -w // Compile and monitor all ts file , The premise is that there is tsconfig.json
tsconfig.json yes ts Configuration file for , You can write notes inside , The common configuration options are as follows :
1. include: Define the directory where you want to compile the file , The default value is ['**/*'],** Represents any directory ,* Represents any file
"include": [ "./src/**/*" ]
2. exclude: No need to compile the file directory , The default value is ["node_modules", "bower_components", "jspm_packages"]
"exclude": [ "./src/hello/**/*" ]
3.extends: Define the inherited configuration file , Introduce configuration items that you don't want to write repeatedly
"extends": "./configs/base"
4. files: Specify the list of compiled files , Applicable when there are few compiled files
"files": [
"core.ts",
"tsc.ts",
...
]
5. compilerOptions Compiler options
"compilerOptions": {
"target": "ES3", // Used to specify ts Compiled as es Version of , The value is es edition ( See note below )
"module": "commonjs", // Specify the modular specification to use ( See the following annotation for the value )
"lib": ["es6", "dom"], // Used to specify the library to be used in the project , The front-end running code does not need to change its default value
"outDir": "./dist", // Specify the directory where the compiled files are located
"outFile": "./dist/app.js", // Merge the code into one file , All the code in the global scope will be merged into one file , If you want to merge multiple modules , Need to put module To change the value of amd or system, This function can be completed in combination with packaging tools
"allowJs": false, // Whether the js File for compilation , The default is false
"checkJs": false, // Whether to check js Whether the code is syntactically correct , The default is false
"removeComments": false, // Remove comments
"noEmit": true, // Do not generate compiled files , The default value is false
"noEmitOnError": false, // When there are mistakes , Do not generate compiled files , Default false
"strict": false, // All strictly checked master switches , The four main switches set below
"alwaysStrict": false, // Used to set whether the compiled file uses strict mode , Default false
"noImplicitAny": false, // Implicit is not allowed any type , Default false
"noImlicitThis": false, // It is not allowed to be of indefinite type this, Default false
"strictNullChecks": false, // Strictly check for null values
}
notes :
1.es Current version value :'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext'
2. module The available values are :'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'es2022', 'esnext', 'node16', 'nodenext'
3. When "noImlicitThis": true when
function fn(this: Window){ console.log(this) }
4. "strictNullChecks": true when
let box = document.getElementById('box')
box.addEventListener('click', function(){...}) // here box Report errors , Because there may not be id by box The elements of
边栏推荐
- Contour layout of margin
- What is the reason for the abnormal flow consumption of 4G devices accessing the easygbs platform?
- NVR硬盘录像机通过国标GB28181协议接入EasyCVR,设备通道信息不显示是什么原因?
- UVA 12230 – crossing rivers (probability) "suggested collection"
- Talk about relational database and serverless
- The little money made by the program ape is a P!
- EasyUI date control emptying value
- Jenkins user rights management
- Jerry's initiation of ear pairing, reconnection, and opening of discoverable and connectable cyclic functions [chapter]
- The new version of onespin 360 DV has been released, refreshing the experience of FPGA formal verification function
猜你喜欢
South China x99 platform chicken blood tutorial
Redis - basic use (key, string, list, set, Zset, hash, geo, bitmap, hyperloglog, transaction)
Index summary (assault version)
An in-depth understanding of fp/fn/precision/recall
解决uni-app中uni.request发送POST请求没有反应。
The new version of onespin 360 DV has been released, refreshing the experience of FPGA formal verification function
The little money made by the program ape is a P!
Validutil, "Rethinking the setting of semi supervised learning on graphs"
Jerry's about TWS pairing mode configuration [chapter]
为什么Win11不能显示秒数?Win11时间不显示秒怎么解决?
随机推荐
FatMouse' Trade(杭电1009)
South China x99 platform chicken blood tutorial
[开源] .Net ORM 访问 Firebird 数据库
Embedded development: how to choose the right RTOS for the project?
Hdu4876zcc love cards (multi check questions)
[matrix multiplication] [noi 2012] [cogs963] random number generator
开户必须往账户里面赚钱吗,资金安全吗?
Object-C programming tips timer "suggestions collection"
OpenGL super classic learning notes (1) the first triangle "suggestions collection"
[200 opencv routines] 223 Polygon fitting for feature extraction (cv.approxpolydp)
Jerry's about TWS channel configuration [chapter]
Word inversion implements "suggestions collection"
Demon daddy A1 speech listening initial challenge
Devil daddy B1 hearing the last barrier, break through with all his strength
Nine degree 1201 - traversal of binary sort number - binary sort tree "suggestions collection"
Win11U盘不显示怎么办?Win11插U盘没反应的解决方法
[C language] advanced pointer --- do you really understand pointer?
私募基金在中国合法吗?安全吗?
NVR硬盘录像机通过国标GB28181协议接入EasyCVR,设备通道信息不显示是什么原因?
Have you ever been confused? Once a test / development programmer, ignorant gadget C bird upgrade