Help us understand the problem. What is going on with this article?

Angularでanimejsを動かす

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

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした