Brandon Brandon - 22 days ago 5
TypeScript Question

npm types or typings or @type or what?

I'm using VS 2015 update 3, Angular 2.1.2, Typescript 2.0.6

Can someone please clarify what typings versus npm @types versus whatever other hard to find documentation on something there is this month?

Or just point the way to documentation on what and how to use these things. Preferably the docs should be up to date.

Also, in a related sense, how does one uninstall. Everywhere I look there are helpful extensions to install packages, but nothing to uninstall that I can tell at least. I installed the Package Installer extension, but it seems rather limited.

The pain of using this stuff in Visual Studio is making want to walk away and do MVC again. Maybe it's just me, but it doesn't seem like it ought be this difficult.

Answer

Use @types ( don't use typings )

Pros:

  • Under package.json ( update is done with npm update )
  • No need for separate packages ( typings ), files ( typings.json )...
  • Under node_modules ( cleaner directory structure )

Simplified Declaration File (.d.ts) Acquisition

https://blogs.msdn.microsoft.com/typescript/2016/09/22/announcing-typescript-2-0/