2016-10-04 46 views
1

在beta11中,我將自己的customTypings.d.ts放在typings文件夾中。
該文件夾在Ionic RC.0中不存在。Ionic 2:在RC.0中註冊自定義類型文件

Q)那麼現在如何在RC.0中註冊我的自定義打字文件呢?

例如, customTypings.d.ts:

interface Window { 
    plugins: any; 
} 

declare var SignaturePad: { 
    new(canvas: any, options?: any): any; 
} 

interface CordovaPlugins { 
    OneSignal: any; 
} 

回答

3

這樣做:

  • src目錄中創建自定義文件夾,例如customTypings
  • 將您的自定義類型添加到該目錄中的文件中,例如customTypings.d.ts

然後它們將被包含在編譯中。

DONE。

+1

這對我不起作用。找不到'customTypings.d.ts'。當我嘗試引用它們時,它會查看'src/declarations.d.ts'而不是'customTypings.d.ts'。 – Richard