2015-05-20 70 views
0
///<reference path="HtmlElementsAction.ts" /> 
///<reference path="DesktopSocket.ts" /> 

module Pong { 
     export class webPage extends HtmlElementsAction { 
      private socket; 

      constructor() { 
       super(); 
       this.socket = new DesktopSocket(this); 
      } 
     } 
    } 

我已经这段代码。Typescript在类中创建新实例

当我执行它,在浏览器的控制台错误:

Uncaught TypeError: undefined is not a function 

错误是新DesktopSocket(this);

我在做什么错?

回答

3

常见错误。检查脚本标记的顺序,或者如果使用“out”参数的顺序来编译tsc。