diff --git a/package.json b/package.json index 293f9cc..c5ec456 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sharkitek/core", - "version": "2.1.0", + "version": "2.1.1", "description": "Sharkitek core models library.", "keywords": [ "sharkitek", diff --git a/src/Model/Types/ObjectType.ts b/src/Model/Types/ObjectType.ts index 22c85fb..61abc21 100644 --- a/src/Model/Types/ObjectType.ts +++ b/src/Model/Types/ObjectType.ts @@ -24,7 +24,7 @@ export class ObjectType extends Type][]).map(([fieldName, fieldDefinition]) => ( // Return an entry with the current field name and the deserialized value. - [fieldName, fieldDefinition.type.deserialize(value[fieldName])] + [fieldName, fieldDefinition.type.deserialize(value?.[fieldName])] )) ) as Record; } @@ -38,7 +38,7 @@ export class ObjectType extends Type][]).map(([fieldName, fieldDefinition]) => ( // Return an entry with the current field name and the serialized value. - [fieldName, fieldDefinition.type.serialize(value[fieldName])] + [fieldName, fieldDefinition.type.serialize(value?.[fieldName])] )) ) as Record; } @@ -52,7 +52,7 @@ export class ObjectType extends Type][]).map(([fieldName, fieldDefinition]) => ( // Return an entry with the current field name and the serialized diff value. - [fieldName, fieldDefinition.type.serializeDiff(value[fieldName])] + [fieldName, fieldDefinition.type.serializeDiff(value?.[fieldName])] )) ) as Record; } @@ -62,7 +62,7 @@ export class ObjectType extends Type][]).forEach(([fieldName, fieldDefinition]) => { // Reset diff of the current field. - fieldDefinition.type.resetDiff(value[fieldName]); + fieldDefinition.type.resetDiff(value?.[fieldName]); }); } }