I am a beginning at writing TypeScript definition files and would like to know the difference between the following two constructs:
declare module activedirectory
and
declare module "activedirectory"
For some reason the former allows me to utilize any classes within one of my Angular services without any sort of import declaration (ex. import activedirectory = require('activedirectory')
. Whenever I declare the latter in my code, it destroys references to my internal modules, for example:
module myModule.Services {
'use strict';
export class MyService implements myModule.Interfaces.IMyService {
.....
Can no longer locate the "myModule.Interfaces" namespace.
The TypeScript team recognized the confusion, and that's why modules without quotes are now called namespaces.
Going forward, internal modules will be called ‘namespace’. We chose to use this term because of the closeness between how this form works and namespaces in other languages [...] http://blogs.msdn.com/b/typescript/archive/2015/07/20/announcing-typescript-1-5.aspx
The quoted modules are ES6 modules, and need to be be imported using an import statement like import 'activedirectory';
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