npm types or typings or @type or what?

北慕城南 提交于 2019-12-23 07:47:14

问题


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.


回答1:


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/



来源:https://stackoverflow.com/questions/40592539/npm-types-or-typings-or-type-or-what

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!