ts的基本用法和其中对应的属性和参数的使用方法;
{
“compilerOptions”:{
"target": "es5", // target用于指定编译之后的版本目录
"module": "commonjs", // module用来指定要使用的模板标准
"lib":[ // lib用于指定要包含在编译中的库文件
"es6",
"dom"
],
"allowJs": true, // allowJs用来指定是否允许编译JS文件,默认false,即不编译JS文件
"checkJs": true, // checkJs用来指定是否检查和报告JS文件中的错误,默认false
"jsx": "preserve", // 指定jsx代码用于的开发环境:'preserve','react-native',or 'react
"declaration": true, // declaration用来指定是否在编译的时候生成相的d.ts声明文件,如果设为true,编译每个ts文件之后会生成一个js文件和一个声明文件,但是declaration和allowJs不能同时设为true
"declarationMap": true, // declarationMap用来指定编译时是否生成.map文件
"sourceMap": true, // socuceMap用来指定编译时是否生成.map文件
"outFile": "./", // outFile用于指定输出文件合并为一个文件,只有设置module的值为amd和system模块时才支持这个配置
"outDir": "./", // outDir用来指定输出文件夹,值为一个文件夹路径字符串,输出的文件都将放置在这个文件夹
"rootDir": "./", // rootDir用来指定编译文件的根目录,编译器会在根目录查找入口文件
"composite": true, // composite是否编译构建引用项目
"removeComments": true, // removeComments用于指定是否将编译后的文件注释删掉,设为true的话即删除注释,默认为false
"noEmit": true, // noEmit不生成编译文件
"importHelpers": true, // importHelpers指定是否引入tslib里的复制工具函数,默认为false
"downlevelIteration": true, //当target为"ES5"或"ES3"时,为"for-of" "spread"和"destructuring"中的迭代器提供完全支持
"isolatedModules": true, // isolatedModules指定是否将每个文件作为单独的模块,默认为true,他不可以和declaration同时设定
"strict": true, // strict用于指定是否启动所有类型检查,如果设为true这回同时开启下面这几个严格检查,默认为false
"noImplicitAny": true, // strictNullChecks当设为true时,null和undefined值不能赋值给非这两种类型的值,别的类型的值也不能赋给他们,除了any类型,还有个例外就是undefined可以赋值给void类型
}
}