2015-05-20 73 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。