2016-10-06 130 views
0

我最近将我的Angular2版本升级到最终版本,并且awesome-typescript-loader需要一个声明文件。我该如何做以及将该类型文件链接到何处?我使用angular2-webpack-starter。我的应用程序提供者定义中有几个.d.ts文件。使用Awesome Typescript Loader处理.d.ts文件

现在所有的尝试编译他们喜欢的东西结束:

Module build failed: Error: Debug Failure. False expression: Output generation failed 
at Object.assert (node_modules\typescript\lib\typescript.js:2407:23) 
at Object.transpileModule (node_modules\typescript\lib\typescript.js:54401:18) 
at State.fastEmit (node_modules\awesome-typescript-loader\src\host.ts:264:39) 
at transform (node_modules\awesome-typescript-loader\src\index.ts:164:28) 
at transformationFunction (node_modules\awesome-typescript-loader\src\index.ts:89:48) 
at compiler (node_modules\awesome-typescript-loader\src\index.ts:105:34) 
at Object.loader (node_modules\awesome-typescript-loader\src\index.ts:18:18) 
@ ./src/app/providers/socket/index.ts 6:9-40 
@ ./src/app/providers/socket/chat-service.ts 
@ ./src/app/pages/restricted/restricted.ts 
@ ./src/app/app.routes.ts 
@ ./src/app/app.module.ts 
@ ./src/app/index.ts 
@ ./src/main.browser.ts 
@ multi main 

建议从ATL自述:

All declaration files should be resolvable from the entry file. The easiest way to do this is to create a references.d.ts file which contains references to all of your declaration files. Then reference references.d.ts from your entry file. 

提前感谢!

回答

1

我从输入源中排除了.d.ts文件,而是使用tsconfig.json的typingsRoot属性定义了.d.ts文件的位置。当输入文件没有输出时,应该抛出一个错误似乎很愚蠢。这将是相当常见的,例如仅包含接口定义的文件。

0

由于我的.d.ts文件只包含接口,我已将它们全部更名为[某些] .interface.ts。现在我只是custom-typings.d.ts,它链接在tsconfig.json其他的东西。

相关问题