Reputation: 3531
The type definition for the ngstorage library is as follows:
import * as angular from 'angular';
declare module 'angular' {
export namespace storage {
export interface IStorageService {
//interface definition
}
export interface IStorageProvider extends angular.IServiceProvider {
//interface definition
}
}
}
Three questions:
export namespace storage
?How do I import IStorageService
into my .ts
files? Nothing I've tried so far works.
import { IStorageService } from 'ngstorage'
import { IStorageService } from 'angular.storage'
or just directly refer to IStorageService like so:
angular.storage.IStorageService
Upvotes: 0
Views: 649
Reputation: 164129
It's called Module Augmentation, and it's a way to add definitions to existing modules.
In this case, when you are importing the file that you posted it will add the new definitions to the angular
module, just like the js file does at runtime.
You should be able to import it like so:
import * as angular from 'ngstorage';
let a: angular.storage.IStorageService;
...
Try:
import * as angular from 'angular';
import 'ngstorage';
let a: angular.storage.IStorageService;
Upvotes: 1