1. 打開WebStorm,找到File->Setting->File Watchers,默認情況下是空的,點擊右側的“+”號,選擇<custom>:
2. 新建Watcher,名字為TypeScript,File type 選擇“TypeScript”,Program為nodejs下tsc.cmd文件,Arguments為--target "ES5",Output paths to refresh 為 $FileNameWithoutExtension$.js,點擊“ok”按鈕。如下圖所示:
3.選中“TypeScript”前面的“Enabled”,點擊“ok”。