2016-10-04 82 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