- 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.
推薦閱讀
- 極簡算法史:從數學到機器的故事
- Redis Applied Design Patterns
- Visual C++串口通信開發入門與編程實踐
- Microsoft Application Virtualization Cookbook
- 摩登創客:與智能手機和平板電腦共舞
- Mastering Entity Framework
- Django Design Patterns and Best Practices
- RTC程序設計:實時音視頻權威指南
- Python漫游數學王國:高等數學、線性代數、數理統計及運籌學
- Visual C#.NET程序設計
- Java EE 7 Performance Tuning and Optimization
- Building Machine Learning Systems with Python(Second Edition)
- 小程序,巧應用:微信小程序開發實戰(第2版)
- C語言程序設計
- Distributed Computing with Python