监视并自动编译
单个文件:tsc app.ts -w
监视所有文件:tsc -w
tsconfig.json
1. include:用来指定那些ts文件需要被编译
"include":[ "./src/**/*" ]
**任意目录
*任意文件
2. exclude:指定那些文件不被编译
“exclude”:[ … ]
默认不编译目 [“node_modules”,“bower_components”,“jspm_packages”]
3. files被编译的文件,文件少的时候用,一般不用
“files”:[ … ]
4. “compilerOptions”: {} 重要
- target(字符串):指定ts文件编译成ES的哪个版本的js文件, es5
- module:指定使用的模块化规范
- lib:指定使用的库, [ … ]
- outDir:编译后,文件存放位置
- outFile: 打包成一个文件,将文件存放位置
- allowJs:是否对js文件进行编译,默认false
- checkJs:false 是否检测js代码,符合语法规范,默认false
- removeComments: 是否移除注释,true
- noEmit: 是否生成编译文件,false,
- noEmitOnError: 有错误时是否生成编译文件,false
- alwaysStrict: 设置严格模式 true,
- noImplicitAny: true 是否运行隐式any
- strictNullChecks: true 严格检查空值
- strict: true, 严格检查总开关