Preventing Name Conflicts
Note that it’s possible to define many types in the global scope when writing a global declaration file. We strongly discourage this as it leads to possible unresolvable name conflicts when many declaration files are in a project.
A simple rule to follow is to only declare types namespaced by whatever global variable the library defines. For example, if the library defines the global value ‘cats’, you should write
declare namespace cats { interface KittySettings { } }
But not
// at top-level interface CatsKittySettings { }
This guidance also ensures that the library can be transitioned to UMD without breaking declaration file users.
Please login to continue.