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
Typings is an NPM package to handle the type definitions associated with third-party libraries. This way the tooling will be aware of the types used inside the application. After explaining the typings library, Scott summarizes the different coding syntax options with Angular 2.
Declaration files, if you're not familiar, are just files that describe the shape of an existing JavaScript codebase to TypeScript. By using declaration files (also called . d. ts files), you can avoid misusing libraries and get things like completions in your editor.
The . d. ts file is usually placed adjacent to the . ts file, it is providing the typings for.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With