gpt4 book ai didi

arrays - Angular - 无法添加属性 xxxx,对象不可扩展

转载 作者:搜寻专家 更新时间:2023-10-30 21:08:02 25 4
gpt4 key购买 nike

<分区>

我使用 Typescript (Angular) 我有这个错误:Cannot add property media, object is not extensible

我想在我的步骤对象中添加一个媒体元素。最初的 Step 对象不包含任何媒体数组。

export interface Step {
duration: string;
instructions: string;
ingredients_instructions?: string;
ingredients?: Quantity[];
media?: Media[];
action?: CookingAction;
}

export interface Media {
id: string;
author: string;
license: string;
creation_date: string;
modification_date: string;
bytes: string;
}

stepsSelection: Step[] = [];
...
const media = {} as Media;
media.bytes = 'foo';
media.license = 'DR';
this.stepsSelection[i].media = [ ];
this.stepsSelection[i].media[0] = media;

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com