typescript 基础配置文件

tsconfig.json:

{
    /* 
        tsconfg.json是ts编译器的配置文件,ts编译器可以根据它的信息来对代码进行编译
        "include"  用来指定哪些ts文件需要被编译   一个*表示任意文件  两个*表示任意目录
        "exclude" 不需要被编译的文件目录  默认值 ["node_modules","bower_components","jspm_packages"]
    */
    "include": [
        "./src/**/*"
    ],
    // "exclude": [
    //     "./src/hello/**/*"
    // ],
    /* 
        compilerOptions 编译器的选项
    */
    "compilerOptions": {
        // target 用来指定被编译为的ES的版本
        "target": "ES2015",
        // module 指定要使用的模块化的规范   
        //  'none' 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'.
        "module":"ES2015",
        // lib用来指定项目中要使用的库
        // "lib": []
        // outDir 用来制动编译后文件所在的目录
        "outDir": "./dist",
        // 将代码合并为一个文件  设置outFile后,所有的全局作用域中的代码回合并到同一个文件中
        // "outFile": "./dist/app.js"

        // 是否对js文件镜像编译,默认false
        "allowJs": true,
        // 是否检查js代码是否符合语法规范,默认false
        "checkJs": true,
        // 是否去掉注释 默认false
        "removeComments": true,
        //不生成编译后的文件 默认false
        "noEmit": false,
        // 当有错误时不生成编译后文件
        "noEmitOnError": false,
        // 所有严格模式的总开关
        "strict": false,
        // 用来设置编译后的文件是否使用严格模式,默认false
        "alwaysStrict": false,
        //不允许隐式any
        "noImplicitAny": false,
        // 不允许不明确的this
        "noImplicitThis": false,
        // 严格的检查空值
        "strictNullChecks": true,
    }
}

猜你喜欢

转载自blog.csdn.net/qq_36818077/article/details/113903783