我使用打字稿2.1.5與Visual Studio 2015年該項目被配置爲使用「ES 2015」模塊系統和ECMAScript 6需要與打字稿模塊/命名空間進口
我試圖幫助使用角度本地存儲模塊,這是由DefinitelyTyped as定義:
declare module 'angular' {
export namespace local.storage {
interface ILocalStorageService {
}
}
}
在我的服務之一,我想導入接口,這樣我就可以使用它,就像這樣:
module Foooooo.Services {
export class FooService {
constructor(private localStorageService: local.storage.ILocalStorageService) {
}
}
}
我用盡了一切我能想到的澆注文件結束後:
import local from "angular"; // bzzzzzt
import * as ang from "angular"; // causes all of my other interfaces to no longer resolve
import { local } from "angular"; // doesn't compile
import { ILocalStorageService } from "angular"; // other interfaces don't resolve anymore
import { local.ILocalStorageService } from "angular"; // nopenope
import ILocalStorageService = require("angular"); // error: not compatible with ECMAScript 6 or higher
我如何得到這個正確導入?