基础配置(Root Fields)
files
Specifies an allowlist of files to include in the program. An error occurs if any of the files can’t be found.
用于只编译指定的少数文件时
extend
用于继承来自于其他文件的config
include
包含的要被编译的文件
include and exclude support wildcard characters to make glob patterns:
- matches zero or more characters (excluding directory separators)
- ? matches any one character (excluding directory separators)
- **/ matches any directory nested to any level
如果没有声明类型,则只会默认编译(.ts, .tsx, .d.ts)或者allowJs为True编译.js文件。
exclude
声明在include的文件中不被编译的文件,本质上是重写了include
的声明域。
特别的,如果文件在files
中被声明,或代码里被引用,或type
中被引入,或/// <reference
(不太懂),则依然会被编译。
reference
我的理解是有点类似于模块化,可以引入另一个编译的模块,并且用.d.ts
文件进行接口使用(有点像C++的.h
文件)
编译选项(Compiler Options)
类型check
allowUnreachableCode
对于代码中无法到达的位置进行提示
alwaysStrict
在所有编译后代码前增加严格模式