无法添加属性“X",对象不可扩展 angular 9 [英] Cannot add property "X", object is not extensible angular 9
问题描述
从 Angular 8 更新到 Angular 9 几天后,我在很多地方都遇到了这个问题.早些时候它运行良好.
I have encountered this issue on many places after some days of updating from Angular 8 to Angular 9. Earlier it was working fine.
谁能帮我看看有什么问题.下面的示例代码
Can anyone help me what's the problem. Example code below
list.reduce((acc, curr) => {
const obj = {};
obj['x'] = curr['Y'];
});
推荐答案
我在这里参考 Ngrx 版本 8 到 9 的更改列表和迁移指南
I refer change list of Ngrx version 8 to 9 and migration guideline here
https://ngrx.io/guide/migration/v9
我发现有一个与 angular 9 的不变性相关的特殊变化.他们在那里定义了动作、状态和可序列化相关的不变性逻辑.我在这里尝试了他们建议的解决 Ngrx V9 更新问题的方法
As I found there is a special change related to immutability with angular 9. They have defined Action, state and serializability related immutability logic there. And I tried out the method that they have suggested to resolve those issues with Ngrx V9 update here
https://ngrx.io/guide/store/configuration/runtime-checks
@ngrx/store
附带五 (5) 个内置运行时检查.尝试禁用所有检查
@ngrx/store
ships with five (5) built-in runtime checks. Try disabled all checks
这篇关于无法添加属性“X",对象不可扩展 angular 9的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!