Reputation: 2623
/// <amd-module name="AdvancedSlider"/>
import * as $ from "jquery";
import * as Wnumb from "wnumb";
//also tried import {wNumb} from "wnumb"
//and tried import {wNumb} from "wNumb"
export class AdvancedSlider extends Riot.Element { ...blah ... }
This results in Error TS2307: Cannot find module 'wnumb'.
However, if I do:
/// <amd-module name="AdvancedSlider"/>
import * as $ from "jquery";
import "wnumb";
export class AdvancedSlider extends Riot.Element { ...blah ... }
It compiles.
Using the typings from https://github.com/retyped/wnumb-tsd-ambient/blob/master/wnumb.d.ts I need to do the former because I need to get a handle to it in the AdvancedSlider class.
What am I doing wrong?
Edit 2 August 2016
Couldn't get it to work.
Used:
const wNumb = require("wnumb");
Which seems like a fail to me. Moving on...
Upvotes: 2
Views: 1604
Reputation: 41
As late as it is, I ran into the same problem as you :(
I am however using webapck 2.x, anyway this might help the next person to come but I got it to work by using the webpack ProvidePlugin:
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
wNumb: "wnumb"
})
Also have the typings from https://github.com/DefinitelyTyped/DefinitelyTyped
Hope it works for anyone else.
Upvotes: 1