当前位置:网站首页>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
边栏推荐
- 你可曾迷茫?曾经的测试/开发程序员,懵懂的小菜C鸟升级......
- QT compile IOT management platform 39 alarm linkage
- Datatable data conversion to entity
- Restore backup data on persistent volumes
- Win11如何解禁键盘?Win11解禁键盘的方法
- Implementation of mahout Pearson correlation
- How does win11 unblock the keyboard? Method of unlocking keyboard in win11
- 2022 how to evaluate and select low code development platforms?
- Jenkins user rights management
- Can I open a stock account directly online now? Is it safe?
猜你喜欢

Focusing on safety in 1995, Volvo will focus on safety in the field of intelligent driving and electrification in the future

Reptile combat (VII): pictures of the king of reptiles' heroes
![[开源] .Net ORM 访问 Firebird 数据库](/img/a2/4eff4f0af53bf3b9839a73019a212f.png)
[开源] .Net ORM 访问 Firebird 数据库

Automatic classification of defective photovoltaic module cells in electronic images

Goal: do not exclude yaml syntax. Try to get started quickly

Google SEO external chain backlinks research tool recommendation

Open source OA development platform: contract management user manual

你可曾迷茫?曾经的测试/开发程序员,懵懂的小菜C鸟升级......

Use camunda to do workflow design and reject operations
![Jerry's about TWS channel configuration [chapter]](/img/94/fde5054fc412b786cd9864215e912c.png)
Jerry's about TWS channel configuration [chapter]
随机推荐
Actual combat: sqlserver 2008 Extended event XML is converted to standard table format [easy to understand]
Automatic classification of defective photovoltaic module cells in electronic images
Win11U盘不显示怎么办?Win11插U盘没反应的解决方法
Le capital - investissement est - il légal en Chine? C'est sûr?
Ad domain group policy management
Jerry's power on automatic pairing [chapter]
Word inversion implements "suggestions collection"
Focusing on safety in 1995, Volvo will focus on safety in the field of intelligent driving and electrification in the future
EasyCVR配置中心录像计划页面调整分辨率时的显示优化
Problems encountered in installing mysql8 for Ubuntu and the detailed installation process
Addition, deletion, modification and query of sqlhelper
Use br to back up tidb cluster data to azure blob storage
Awk processing JSON processing
Is it safe to open an account of BOC shares in kainiu in 2022?
Object-C programming tips timer "suggestions collection"
华泰证券可以做到万一佣金吗,万一开户安全嘛
[UVALive 6663 Count the Regions] (dfs + 离散化)[通俗易懂]
An in-depth understanding of fp/fn/precision/recall
ISO 26262 - considerations other than requirements based testing
FatMouse' Trade(杭电1009)