我正在将项目转换为 Typescript。我在使用 toastr 时遇到问题。
import {toastr} from "toastr";
我用 Nuget 下载了 typescript 定义文件,并将其包含在项目中。
它在文件末尾有这个导出:
declare var toastr: Toastr;
declare module "toastr" {
export = toastr;
}
但是,我收到编译时错误:Modle "toastr"has no exported member 'toastr'
我该如何解决这个问题?
最佳答案
尝试以下操作:
import * as toastr from "toastr";
这样做会将整个模块导入为 toastr
。
关于typescript - 如何让 toastr 在 Typescript 中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32318663/