From 364575b3f0743c2cf9b2db855f3b1702461a3fad 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. --- js/src/common/Model.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/js/src/common/Model.ts b/js/src/common/Model.ts index 9cea14335..338b66207 100644 --- a/js/src/common/Model.ts +++ b/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); }