LoginSignup
7
7

More than 5 years have passed since last update.

WebStormでtypingsを使ってTypeScriptの定義ファイル管理

Last updated at Posted at 2016-03-16

tsddeprecatedになりました。
そこで型定義ファイル(*.d.ts)の管理をTypingsに移行しましょう。

tsdからtypingsへの移行

tsdからtypingsへの移行はマニュアルにあるように、たった3コマンド(ディレクトリ移動含まず)で完了します。

$ cd /path/to/project
$ rm -rf typings
$ typings init --upgrade
$ typings install

ただし、このままだとWebStormやtscが混乱します。
これはtypingsではmainbrowserの二つをtypingsディレクトリ内に配置するため、両方を読み込むと衝突してしまうためです。

tsconfig.jsonをtypingsに対応させる

tscが混乱しないようにtsconfig.jsonexcludeにプロパティを下記のように変更します。

{
  // いろんな設定...
  "exclude": [
     "node_modules",
     "typings/browser.d.ts", // これと
     "typings/browser",      // これを追加
     // ほかの無視したいもの...
  ]
}

WebStormの混乱を収める

同様に、WebStormでProjectツリーを表示して、typings/browserディレクトリを右クリック、
コンテキストメニューからMark Directory As -> Excluded を選択して無視するようにしましょう。

7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7