当前位置:网站首页>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
边栏推荐
- Awk processing JSON processing
- Is private equity legal in China? Is it safe?
- Jerry's key to initiate pairing [chapter]
- Cv2.resize function reports an error: error: (-215:assertion failed) func= 0 in function ‘cv::hal::resize‘
- Can I open a stock account directly online now? Is it safe?
- Le capital - investissement est - il légal en Chine? C'est sûr?
- Differences and connections between MinGW, mingw-w64, tdm-gcc and other tool chains "suggestions collection"
- Datatable data conversion to entity
- 大数据开源项目,一站式全自动化全生命周期运维管家ChengYing(承影)走向何方?
- Magic weapon - sensitive file discovery tool
猜你喜欢
![The maximum number of meetings you can attend [greedy + priority queue]](/img/f3/e8e939e0393efc404cc159d7d33364.png)
The maximum number of meetings you can attend [greedy + priority queue]
![Restapi version control strategy [eolink translation]](/img/65/decbc158f467ab8c8923c5947af535.png)
Restapi version control strategy [eolink translation]

Reptile combat (VII): pictures of the king of reptiles' heroes

648. Word replacement

Kirin Xin'an operating system derivative solution | storage multipath management system, effectively improving the reliability of data transmission

Embedded development: how to choose the right RTOS for the project?

An overview of the latest research progress of "efficient deep segmentation of labels" at Shanghai Jiaotong University, which comprehensively expounds the deep segmentation methods of unsupervised, ro

Open source OA development platform: contract management user manual

L'enregistreur de disque dur NVR est connecté à easycvr par le Protocole GB 28181. Quelle est la raison pour laquelle l'information sur le canal de l'appareil n'est pas affichée?

Why can't win11 display seconds? How to solve the problem that win11 time does not display seconds?
随机推荐
How can big state-owned banks break the anti fraud dilemma?
Take the intersection of two sets
L2:ZK-Rollup的现状,前景和痛点
Lingyun going to sea | saihe & Huawei cloud: jointly help the sustainable development of cross-border e-commerce industry
Dry goods sharing | devaxpress v22.1 original help document download collection
Jerry's test box configuration channel [chapter]
gridView自己定义做时间排版「建议收藏」
私募基金在中国合法吗?安全吗?
How does win11 time display the day of the week? How does win11 display the day of the week today?
Awk processing JSON processing
Codeforces 474 F. Ant colony
Ad domain group policy management
Jerry's manual matching method [chapter]
Open source OA development platform: contract management user manual
Demon daddy A1 speech listening initial challenge
Index summary (assault version)
Backup tidb cluster to persistent volume
Codeforces round 275 (Div. 2) C – diverse permutation (construction) [easy to understand]
Insufficient permissions
Develop those things: go plus c.free to free memory, and what are the reasons for compilation errors?