import ngstorage with webpack

瘦欲@ 提交于 2019-12-25 00:27:11

问题


I am trying to import npm package ngstorage in my angularjs v1.x (typescript) project using @types/ngstorage

the index.d.ts contains

declare namespace angular.storage {

        export interface IStorageService {
        }
}

if I do like below in my .ts files

import * as angular from 'angular';

var storage: angular.storage.IStorageService;

I am getting compilation error

namespace angular and no exported member storage


回答1:


finally I was able to get it work

        import { ngStorage } from 'ngStorage';

the namespace and not the package name should matter when doing an import



来源:https://stackoverflow.com/questions/46276113/import-ngstorage-with-webpack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!