47

I just started playing with angular 2, and I saw that many projects that are available on the web have a folder called typings. Digging more into the problem I found that it has something to do with https://www.npmjs.com/package/typings package. I read their documentation but I didn't understand exactly why do we need typings. Can you provide some example where typings are needed or helpful. Thanks

Doua Beri
  • 10,612
  • 18
  • 89
  • 138

1 Answers1

58

AFAIK this allows you to use JS libraries like they had type annotations like fully typed TypeScript code. If they are provided for a JS library you get proper autocompletion support and lint checks, ...

See also

Community
  • 1
  • 1
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • 22
    +1 Jesus you wouldn't believe how a basic explanation of the purpose of "Typings" is just nowhere on the internet – joshcomley Sep 24 '16 at 12:46
  • If we are installing typed files that is a Javascript library transformed into typed one, and compiled down to Javascript then what happens to node_modules that we import – blackHawk Dec 01 '16 at 05:27
  • Do we only need type defination files not node_modules? – blackHawk Dec 01 '16 at 05:32
  • 1
    Type definition files provide better experience when using JS libraries with auto completion and type checking but are ignored otherwise. If you install and import TypeScript libraries, they will be compiled to JS and included in the JS build output. – Günter Zöchbauer Dec 01 '16 at 05:36