变量 'module' 的类型必须是 'any',但这里的类型是 'NodeModule'
Variable 'module' must be of type 'any', but here has type 'NodeModule'
我正在开发 Angular project and recently installed ng2-dropdown-treeview 1.0.5。安装后,我用 npm start
.
重启了我的服务器
我的服务器日志打印以下错误:
[PATH]\node_modules\@types\node\index.d.ts:82:13
Subsequent variable declarations must have the same type. Variable 'module' must be of type 'any', but here has type 'NodeModule'.
我根据错误导航到 index.d.ts:82 并将 declare var module: NodeModule;
更改为 declare var module: any
。
但它导致我的开发工具控制台出现错误:
Uncaught TypeError: ctorParameters.map is not a function.
它指向 vendor.bundle.js.35429:
// API of tsickle for lowering decorators to properties on the class.
if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__facade_lang__["e" /* isPresent */])(typeOrFunc.ctorParameters)) {
var ctorParameters = typeOrFunc.ctorParameters;
var paramTypes_1 = ctorParameters.map(function (ctorParam /** TODO #9100 */) { return ctorParam && ctorParam.type; });
var paramAnnotations_1 = ctorParameters.map(function (ctorParam /** TODO #9100 */) {
return ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators);
});
return this._zipTypesAndAnnotations(paramTypes_1, paramAnnotations_1);
我已经反对像这样更改打包代码,所以我想我会问问是否有其他人遇到过类似的问题。非常感谢任何帮助!
最终,问题是与 ng2-dnd 的依赖冲突。从应用程序中删除其引用后,错误就得到解决。
我遇到了类似的事情,而不是 "any",而是 "string"。我不知何故不小心添加了导致问题的额外导入。
import { element } from 'protractor';
这是我的冒犯者。如果其他人遇到此问题,可能会开始删除您的一些导入,直到您弄清楚您添加的是哪一个导致此问题发生。
我正在开发 Angular project and recently installed ng2-dropdown-treeview 1.0.5。安装后,我用 npm start
.
我的服务器日志打印以下错误:
[PATH]\node_modules\@types\node\index.d.ts:82:13
Subsequent variable declarations must have the same type. Variable 'module' must be of type 'any', but here has type 'NodeModule'.
我根据错误导航到 index.d.ts:82 并将 declare var module: NodeModule;
更改为 declare var module: any
。
但它导致我的开发工具控制台出现错误:
Uncaught TypeError: ctorParameters.map is not a function.
它指向 vendor.bundle.js.35429:
// API of tsickle for lowering decorators to properties on the class.
if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__facade_lang__["e" /* isPresent */])(typeOrFunc.ctorParameters)) {
var ctorParameters = typeOrFunc.ctorParameters;
var paramTypes_1 = ctorParameters.map(function (ctorParam /** TODO #9100 */) { return ctorParam && ctorParam.type; });
var paramAnnotations_1 = ctorParameters.map(function (ctorParam /** TODO #9100 */) {
return ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators);
});
return this._zipTypesAndAnnotations(paramTypes_1, paramAnnotations_1);
我已经反对像这样更改打包代码,所以我想我会问问是否有其他人遇到过类似的问题。非常感谢任何帮助!
最终,问题是与 ng2-dnd 的依赖冲突。从应用程序中删除其引用后,错误就得到解决。
我遇到了类似的事情,而不是 "any",而是 "string"。我不知何故不小心添加了导致问题的额外导入。
import { element } from 'protractor';
这是我的冒犯者。如果其他人遇到此问题,可能会开始删除您的一些导入,直到您弄清楚您添加的是哪一个导致此问题发生。