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.
This commit is contained in:
Alexander Skvortsov 2021-12-13 12:34:51 -05:00
parent dc48e2327b
commit 364575b3f0
No known key found for this signature in database
GPG Key ID: C4E3BBF9C3412B4C

View File

@ -110,6 +110,7 @@ export default abstract class Model {
}
if ('attributes' in data) {
this.data.attributes ||= {};
Object.assign(this.data.attributes, data.attributes);
}