- 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.
推薦閱讀
- Vue.js 3.x快速入門
- Practical DevOps
- Java:Data Science Made Easy
- Mastering Julia
- Microsoft Dynamics AX 2012 R3 Financial Management
- PHP與MySQL權威指南
- Scala Functional Programming Patterns
- Sails.js Essentials
- 數據分析與挖掘算法:Python實戰
- Learning Concurrency in Python
- Microsoft HoloLens By Example
- 安卓工程師教你玩轉Android
- Offer來了:Java面試核心知識點精講(框架篇)
- Mastering Machine Learning with R
- Advanced Analytics with R and Tableau