Still new at TypeScript so this question may sound dumb to some of you. I have a ToolTip class like this:
class ToolTip{
public static show (str:string):void{
console.log ("ToolTip show():" + str);
}
public static hide():void{
console.log ("ToolTip hide()");
}
}
export = ToolTip;
And I want to call it from another class
import ToolTip = require ("app/view/common/Tooltip");
class Button {
......
private handleMouseEvent(event:MouseEvent):void {
switch (event.type) {
case "mouseover":
ToolTip.show("tool tip string");
break;
case "mouseout":
ToolTip.hide();
break;
}
}
......
}
export = MenuItem;
But it gives me this error:
Uncaught TypeError: Object app/view/common/Tooltip has no method 'show'
Any idea how to fix this?
As you can see the code works fine (compiles and runs) :
So possible reasons why it would not work for you :
--module commonjs
option (Video Tutorial)Tooltip.ts
which can cause nodejs to run what you might not have expected. If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With