LoginSignup
0
0

More than 3 years have passed since last update.

Angularでanimejsを動かす

Posted at

Angularでanimejsを補完が効くようにする

スクリーンショット 2020-02-17 18.27.03.png

animejsはできることが多いですが、補完が効いたほうが、こういうのも使えるのかと幅を広げると共にミスも減りますよね:santa:

TL;DR

  • @types/animejsを使用
  • tsconfig.jsonのallowSyntheticDefaultImportstrueに設定

環境

試した環境は下記です:santa:

package.json

// "dependencies"
"@angular/core": "~9.0.1",
"@angular/cli": "~9.0.2",
"animejs": "^3.1.0",

// "devDependencies"
"@types/animejs": "^3.1.0",

animejsのpackageを追加

既存のプロジェクトでも、新規でも構いません:santa:

yarn add animejs; (or npm i animejs --save)
yarn add -D @types/animejs; (or npm i animejs -D)

or
npm i animejs --save
npm i animejs -D

tsconfig.jsonのcompilerOptions.allowSyntheticDefaultImportstrueにする

tsconfig.json
{
    ~省略~
    "allowSyntheticDefaultImports": true
  },
    ~省略~
}

これで型の恩恵を受けれるようになりました:santa:

スクリーンショット 2020-02-17 18.27.03.png

0
0
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
0
0