Klas Mellbourn Klas Mellbourn - 1 month ago 19
TypeScript Question

How to include definitely typed files in an Angular2 angular-cli based project

What is the best practice for this scenario:

I have created an Angular2 project using

angular-cli
(i.e. using
ng new
)

I want to include TypeScript types from definitely typed

For example, should I use typings to install the types? How do I make sure the types are included in the
ng build
?

If you answer is that I should hack the
webpack
settings somehow, please include how I would do that, since I only have the
angular-cli.json
file

Answer

Angular-cli uses typescript 2.0, you just need to search for the typings on npm, say you want jquery types, just install them:

npm install --save @types/jquery

And that's it. More info here

Comments