整个main.ts:
import { enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppModule } from './app/app.module'; // depending on the env mode,enable prod mode or add debugging modules if (process.env.ENV === 'build') { enableProdMode(); } export function main() { return platformBrowserDynamic().bootstrapModule(AppModule); } if (document.readyState === 'complete') { main(); } else { document.addEventListener('DOMContentLoaded',main); }
一些错误(不是全部):
[default] /xxx/src/main.ts:11:96 Index signature of object type implicitly has an 'any' type. ... [default] /xxx/src/main.ts:11:853 Parameter 'store' implicitly has an 'any' type.
报告的立场(例如11:96,11:853)是无用的 – 那里什么都没有.我应该怎么处理这些报告错误的错误?我怎样才能找到这些错误的真实位置?如何修复它,以便正确报告?
我正在使用这个种子 – https://github.com/preboot/angular2-webpack/(我认为主文件未经修改).
"noImplicitAny": true,"noImplicitReturns": true,"noImplicitThis": true,"strictNullChecks": true,"forceConsistentCasingInFileNames": true,"skipLibCheck": true
请注意我想要所有这些支票.
同样奇怪的是,它会报告不在我的代码中的标识符.例如.:
Parameter 'dependencies' implicitly has an 'any' type.
由于这个和错误的数量很高,我开始怀疑它报告库中的错误(这很奇怪,因为我有skipLibCheck)或连接结果文件(这也很奇怪,因为所有内容都被编译为es5).但我没有使用TypeScript编译器或Webpack的经验,所以我无法分辨.
Edit1:在询问TypeScript repo后,很明显编译器工作正常.罪魁祸首是TS加载器或webpack本身.
编辑2:这是一个多月,网络伙伴doesn’t seem to be doing anything关于它:(.