12

I am converting a project over to Typescript. I am having issues with toastr.

import {toastr} from "toastr";

I downloaded the typescript definition file with Nuget and included it in the project.

It has this export at the end of the file:

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

However, I get the compile time error: Modle "toastr" has no exported member 'toastr'

How to I resolve this issue?

Greg Gum
  • 33,478
  • 39
  • 162
  • 233

1 Answers1

18

Try the following:

import * as toastr from "toastr";

Doing that will import the entire module as toastr.

David Sherret
  • 101,669
  • 28
  • 188
  • 178