0

I would like to use toastr in a Typescript project. I have enabled AMD. I have added the d.ts file for it.

In app.ts:

/// <reference path="scripts/typings/toastr/toastr.d.ts" /> toastr.info("Test"); 

This compiles and runs, but fails of course because toastr.js is not loaded.

How to I require() toastr?

Have tried:

import toastr = require("toastr"); 

but it gives me a message saying toastr cannot be found.

1 Answer 1

0

I've updated the definitions to allow you to use import/require : https://github.com/borisyankov/DefinitelyTyped/pull/4499

Sign up to request clarification or add additional context in comments.

2 Comments

Thank You @basarat, that resolves that error message. However, requirejs now tries to download it from /toastr instead of from Scripts/toastr. How do I specify the correct path?
@GregGum: add a line to your require-config to specify the baseUrl for loading all scripts.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.