我最近将我的Angular2版本升级到了最终版本,但awesome-typescript-loader需要一个声明文件,因此遇到了问题。我如何才能做到这一点,以及在哪里链接该类型文件?我使用angular2-webpack-starter。在我的应用程序提供商定义中,我有一些.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.提前感谢!
发布于 2016-12-07 01:05:56
我从输入源中排除了.d.ts文件,而是使用tsconfig.json的typingsRoot属性定义了.d.ts文件的位置。在输入文件没有输出的情况下抛出一个错误,这看起来确实很愚蠢。这将是相当常见的,例如只包含接口定义的文件。
发布于 2016-12-07 10:53:14
因为我的.d.ts文件只包含接口,所以我将它们全部重命名为.interface.ts。现在我有了在tsconfig.json中链接的用于其他事情的custom-typings.d.ts。
https://stackoverflow.com/questions/39896424
复制相似问题