如何让toastr在Typescript中工作

时间:2015-08-31 19:34:59

标签: typescript toastr

我正在将项目转换为Typescript。我遇到了问题。

import {toastr} from "toastr";

我用Nuget下载了打字稿定义文件并将其包含在项目中。

它在文件末尾有这个导出:

declare var toastr: Toastr;
declare module "toastr" {
export = toastr;
}

但是,我收到编译时错误:Modle "toastr" has no exported member 'toastr'

如何解决此问题?

1 个答案:

答案 0 :(得分:12)

尝试以下方法:

import * as toastr from "toastr";

这样做会将整个模块导入为toastr

相关问题