TypeScript Compile Options

Compile Options

1. -w, --watch

Watch input files.

Run the compiler in monitor mode. The output files will be monitored, and when source files changes, they will be recompiled automatically.

# monitor test.ts
tsc -w test.ts

# monitor every files
tsc -w

2. tsconfig.json Configuration File

tsconfig.json is the configuration file of TypeScript compiler. TypeScript compiler will compile the code according to the information in the configuration file.

{
    // tsconfig.json is the configuration file of TypeScript compiler. 
    // TypeScript compiler will compile the code according to the information in the configuration file.
    // include: need to compile
    "include": [
        "./**/*"
    ],
    // exclude: need not to compile
    "exclude": [
        ""
    ],
    // compiler option
    "compilerOptions": {
        // compile target: Specify an ES version
        "target": "ES2015",
        // Specify the version of the modular specification.
        // "module": "es2015",
        // Specify library your project use
        "lib": [
            "ES6",
            "DOM"
        ],
        // outDir: Specify the directory of the compiled file.
        "outDir": "./dist",
        // outFile: Merge the code into one file.
        "outFile": "./dist/app.js",
        // allow JS: Whether to compile JS file.
        "allowJs": false,
        // checkJs: Whether to check JS grammar.
        "checkJs": false,
        // removeComments: Whether to remove comments.
        "removeComments": false,
        // Do not generate compiled file.
        "noEmit": false,
        // Do not generate compiled file when has error.
        "noEmitOnError": true,
        // Whether to open All Strict Mode, including the following four.
        "strict": true,
        // - Whether to use Strict Mode always.
        "alwaysStrict": true,
        // - Whether to don't allow to use 'any' implicitly.
        "noImplicitAny": true,
        // - Whether to don't allow to use 'this' implicitly.
        "noImplicitThis": true,
        // - Whether to check null value strictly.
        "strictNullChecks": true,
    }
}
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值