# 安裝 TypeScript
TypeScript 的命令行工具安裝方法如下:
```bash
npm install -g typescript
```
以上命令會在全局環境下安裝 `tsc` 命令,安裝完成之后,我們就可以在任何地方執行 `tsc` 命令了。
編譯一個 TypeScript 文件很簡單:
```bash
tsc hello.ts
```
我們約定使用 TypeScript 編寫的文件以 `.ts` 為后綴,用 TypeScript 編寫 React 時,以 `.tsx` 為后綴。
## 編輯器
TypeScript 最大的優勢便是增強了編輯器和 IDE 的功能,包括代碼補全、接口提示、跳轉到定義、重構等。
主流的編輯器都支持 TypeScript,這里我推薦使用 [Visual Studio Code](https://code.visualstudio.com/)。
它是一款開源,跨終端的輕量級編輯器,內置了 TypeScript 支持。
另外它本身也是[用 TypeScript 編寫的](https://github.com/Microsoft/vscode/)。
下載安裝:https://code.visualstudio.com/
獲取其他編輯器或 IDE 對 TypeScript 的支持:
- [Sublime Text](https://github.com/Microsoft/TypeScript-Sublime-Plugin)
- [Atom](https://atom.io/packages/atom-typescript)
- [WebStorm](https://www.jetbrains.com/webstorm/)
- [Vim](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Editor-Support#vim)
- [Emacs](https://github.com/ananthakumaran/tide)
- [Eclipse](https://github.com/palantir/eclipse-typescript)
- [Visual Studio 2015](https://www.microsoft.com/en-us/download/details.aspx?id=48593)
- [Visual Studio 2013](https://www.microsoft.com/en-us/download/details.aspx?id=48739)
---
- [上一章:什么是 TypeScript](what-is-typescript.md)
- [下一章:Hello TypeScript](hello-typescript.md)