我有这个值,我想覆盖它的一个属性。我尝试了以下方法:fetchOptions: Readonly<HttpFetchOptionsWithPath>((fetchOptions as Writable<HttpFetchOptionsWithPath>).headers as Writable<any>) = { 'new-value': '123', ...(fetchOptions.headers || {}), };但仍然收到错误。TypeError: Cannot assign to read only property 'headers' of object '#<Request>'执行的 js 代码如下所示:fetchOptions.headers = __assign({ 'new-value': '123' }, (fetchOptions.headers || {}));任何想法,我在这里做错了什么?
添加回答
举报
0/150
提交
取消