I am really confused between the ambient and global dependencies. I understood the concept of global dependencies, which means that installing the dependencies globally. But coming to ambient dependencies, I did not understand what it is and now typings recently declared that ambient is now global. I am completely lost.
Can someone please help me clear this confusion.
First off to put you mind somewhat at ease, ambient and global typings are the same thing, it's simply a name change as global better describes their function
As to what they are....
Global declarations, using the simplest definition are typings available in the projects global namespace.
An "external module" is a .d.ts file with a top level import or export. External modules are wrapped by Typings in declare module '....' and after some dependency magic you end up with declarations that do not pollute the projects global name space.
As to why that's important, you can run into conflicts with versions and or duplicate definitions.
Package A depends on version 1.4 of dependency X Package B depends on version 2.0 of dependency X
If the definitions of package A & package B are both global, that version conflict ( different definitions of the same dependency ) end up in the global namespace and the TypeScript compiler blows up.
It all comes down to what scope you want you type declarations to be available in.
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