- Learn React with TypeScript 3
- Carl Rippon
- 132字
- 2021-06-10 19:16:39
tsconfig.json
As we have seen, there are lots of different switches that we can apply to the compilation process, and repeatedly specifying these on the command line is a little clunky. Luckily, we can specify these options in a file called tsconfig.json. The compiler options we have looked at in previous sections are defined in a compilerOptions field without the "--" prefix.
Let's take a look at an example:
- Let's create a tsconfig.json file with the following content:
{
"compilerOptions": {
"target": "esnext",
"outDir": "dist",
"module": "es6",
"moduleResolution": "node",
"sourceMap": true,
"noImplicitReturns": true,
"noImplicitAny": true
}
}
- Let's run a compile without specifying the source file and any flags:
tsc
The compilation will run fine, with the transpiled JavaScript being output to the dist folder along with a source map file.
推薦閱讀
- CockroachDB權威指南
- ReSharper Essentials
- JavaScript+jQuery網頁特效設計任務驅動教程(第2版)
- Microsoft Dynamics 365 Extensions Cookbook
- MongoDB for Java Developers
- Kotlin Standard Library Cookbook
- 軟件項目管理實用教程
- Android Native Development Kit Cookbook
- Android開發:從0到1 (清華開發者書庫)
- 零基礎學Python網絡爬蟲案例實戰全流程詳解(入門與提高篇)
- 時空數據建模及其應用
- 運維前線:一線運維專家的運維方法、技巧與實踐
- 后臺開發:核心技術與應用實踐
- QlikView Unlocked
- Learning Jakarta Struts 1.2: a concise and practical tutorial