From d543ba965610927566b2921d810aa51004827a7d Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Mon, 13 Dec 2021 12:34:51 -0500 Subject: [PATCH] Make sure `this.data.attributes` is initialized. `Object.assign` is not type-safe, and does ensure that the property being assigned to is not undefined. --- framework/core/js/src/common/Model.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/framework/core/js/src/common/Model.ts b/framework/core/js/src/common/Model.ts index 9cea14335..338b66207 100644 --- a/framework/core/js/src/common/Model.ts +++ b/framework/core/js/src/common/Model.ts @@ -110,6 +110,7 @@ export default abstract class Model { } if ('attributes' in data) { + this.data.attributes ||= {}; Object.assign(this.data.attributes, data.attributes); }