TypeScripttypes损坏(错误TS2687):“迭代器”的所有声明必须具有相同的修饰符

在将路由器软件包添加到我的Angular应用程序(需要升级Core,Common,Compiler等)后,我的问题得到了正确的解决。

使用Googlesearchob,特定的错误代码导致了我的一些问题,主要解决scheme是删除node_modules和types并重新创build它们。 我已经这样做了,但经历了同样的不当行为。

在这里,还有一个问题,但它是旧的,涉及到大部分软件包的不同版本,我很难看到它是如何与我的问题。

坦率地说,我有点失落,因为我根本不知道如何排除故障。 下面是我的tsconfig.json,如果它有助于发现奇怪的东西。

编辑

const path = require("path"); const HtmlWebpackPlugin = require("html-webpack-plugin"); const CopyWebpackPlugin = require("copy-webpack-plugin"); const distribution = path.resolve(__dirname, "distribution"); const application = path.resolve(__dirname, "source/application"); const resources = path.resolve(__dirname, "source/resources"); module.exports = { entry: "./source/application/main.ts", output: { path: distribution, filename: "bundle.js" }, module: { loaders: [ { test: /\.png$/, loader: "raw-loader", include: [resources] }, { test: /\.s(a|c)ss$/, loaders: ["raw-loader", "sass-loader"] }, { test: /\.html$/, loader: "raw-loader", include: [application] }, { test: /\.ts$/, loader: "ts-loader", include: [application] }, ] }, resolve: { modules: ["node_modules", application], extensions: [".js", ".ts"] }, performance: {}, devtool: "source-map", context: __dirname, target: "web", externals: [], stats: {}, devServer: { contentBase: distribution, port: 3002 }, plugins: [ new HtmlWebpackPlugin({ template: "./source/index.html" }), new CopyWebpackPlugin([{ from: "./source/resources", to: "resources" }]) ] } 

       

网上收集的解决方案 "TypeScripttypes损坏(错误TS2687):“迭代器”的所有声明必须具有相同的修饰符"

在Webpack.common.js中删除debug = true行,并更改下面的代码

 module.exports = { entry: { 'polyfills': './src/polyfills.ts', 'vendor': './src/vendor.ts', 'app': './src/main.ts' }, resolve: { extensions: ['*', '.js', '.ts'] }, module: { rules: [ ]}, plugins: [ new webpack.ContextReplacementPlugin( // The (\\|\/) piece accounts for path separators in *nix and Windows /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/, helpers.root('./src'), // location of your src {} // a map of your routes ), new webpack.optimize.CommonsChunkPlugin({ name: ['app', 'vendor', 'polyfills'] }),