当前位置:网站首页>TypeScript(tsconfig.json)
TypeScript(tsconfig.json)
2022-07-27 00:26:00 【Much less】
tsconfig.json
Use tsc To compile all files
You must first create a new tsconfig.json file
The internal default content can be deleted first
function tsc command , be-all ts All files will be compiled into js file 

-w command
ts -w The command will monitor all ts file
monitor :js The compiled files will be automatically compiled synchronously , There is no need to compile files separately

tsconfig.json Configuration in
src
./src/**/* ** It refers to any directory ,* Refers to any file

exclude
exclude There are default values , If you do not include those files in the default values , You can not configure exclude
files
files Generally used for relatively small projects , because files List all the documents 
files Need to put The files that need to be compiled are listed
compilerOptions
compilerOptions Compiler options , Determines how the compiler works ts File compilation , It can be said to be the most important configuration 
The main thing is to see compilerOptions Sub options in
target
target Specify which version is compiled js
target If set to ES3, that ts Medium let, After compilation js The file will become var
Set to ESNext It is the latest es edition
Set an incorrect value , There will be everything you can write in the error message es Version writing

module
module Specify the modular specification to use
All the options ( Blue )

notes :
Generally recommended es2015(es2015 Namely es6)
If you put es2015 Change it to commonjs Words , Will be able to import The writing of is changed to require The introduction of writing


notes :
above introduce It should be written in ./m.js, The first picture Inside is Write the wrong
lib
lib Used to specify library
Generally not used
Usage : The code does not run in the browser environment , Is in node Running in the environment of , There's no dom
Values can be separated by commas , Keep writing down

notes :
In general No settings lib It has a default value , The default is the browser's running environment
outDir
outDir Used to specify the directory of the compiled file , That's what you compiled js Where to put the documents
Generally placed on dist Catalog 
outFile
outFile Output file , You can merge the code into one file
You can merge the code in the global scope into a file , There is modular code in the file , We can't merge , Will report a mistake



Merge code with modularity
If you want to merge code with modularity , Just Must be modified module Configuration of
want Change to amd or system The pattern of 
notes :
outFile With a few , Generally, this function is mostly left to the packaging tool
allowJs
allowJs Whether the js File for compilation
Default false
checkJs
checkJs Error checking js Whether the code is syntactically correct , The default is false
commonly allowJs and checkJs Or use it together , Or not at all
removeComments
removeComments Remove comments
noEmit
noEmit Do not generate compiled files
noEmitError
noEmitError When there are errors, the compiled file will not be generated , The default value is false
alwaysScrict
Is to make the compilation strict
alwaysScrict Set the compiled file , Whether to use strict mode , The default value is false
noImplicitAny
noImplicitAny Implicit... Is not allowed any type
noImplicitThis
noImplicitThis It is not allowed to be of indefinite type this
The default value is false
hold noImplicitThis To change the value of true
this Report errors 
resolvent :
to this Specify any type 
strictNullChecks
strictNullChecks Strictly check for null values
For example, give one dom Bind click event , But it's time to dom There may be no or no return , So this check will report an error 

resolvent :
Add a judgment 
Another kind dom Back Add ?. Writing 

strict
strict All strictly checked master switches
It is usually written at the top of all strict inspection options 
Its value is true, The values of all strict mode options are true, And these options can be left blank 
Set to false All are false
notes :
General development suggestions are set to true, Open all strict inspections , This makes the code more rigorous , The code runs with a lower probability of error
边栏推荐
- About no module named'django.db.backends.mysql'
- Knowledge distillation -- pytorch implementation
- Transformers is a graph neural network
- Oracle data guard service, process and protection mode
- Class and object notes I
- 7_ Principal component analysis
- 今日份20220719折腾deeplabcut
- Leetcode topic - binary tree chapter
- PTA 7-4 small generation (DFS)
- Relationship between Unicode and UTF-8
猜你喜欢

Transformers is a graph neural network

ResNet论文解读及代码实现(pytorch)

The difference between SQL join and related subinquiry

Deployment of yolov5 on Jetson nano deepstream

2022_ SummerBlog_ 008
![[PCB open source sharing] stc8a8k64d4 development board](/img/df/14f47295dace857c0a32545c3eca39.png)
[PCB open source sharing] stc8a8k64d4 development board

7_主成分分析法(Principal Component Analysis)

今日份20220719折腾deeplabcut

13_集成学习和随机森林(Ensemble Learning and Random Forests)

Skiasharp's WPF self drawn bouncing ball (case version)
随机推荐
When the label begins with "IMS", why does logcat not print the log?
PTA 7-1 play with binary tree
The crawler parses the object of the web page. Element name method
放图仓库-3(功能图像)
The attorney general and the director of the national security service of Ukraine were dismissed
滑动窗口问题总结
Drawing warehouse-2 (function image)
Course notes of Professor Dalin of robotics platform
Shang school software testing (1) software testing curriculum system, advantages, learning suggestions, understanding software, software testing and defects, software testing process, debugging and te
[PCB open source sharing] stc32g12k128/stc8h8k64u development board
RESNET paper interpretation and code implementation (pytorch)
Chapter 2 develop user traffic interceptors
View where Anaconda created the environment
Web middleware log analysis script 2.0 (shell script)
10_ Evaluate classification
Design of electronic scale based on 51 single chip microcomputer
Signal and system learning zero input response
Complete backpack and 01 Backpack
C and pointer Chapter 18 runtime environment 18.1 judgment of runtime environment
数据库:MySQL基础+CRUD基本操作