diff --git a/src/PKPass.ts b/src/PKPass.ts index a1267c7..081ae9b 100644 --- a/src/PKPass.ts +++ b/src/PKPass.ts @@ -183,8 +183,8 @@ export default class PKPass extends Bundle { * that are composing your pass instance. */ - public get props(): Readonly { - return Utils.freezeRecursive(this[propsSymbol]); + public get props(): Schemas.PassProps { + return Utils.cloneRecursive(this[propsSymbol]); } /** diff --git a/src/utils.ts b/src/utils.ts index 5db486e..6636a9d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -81,7 +81,7 @@ export function removeHidden(from: Array): Array { * @returns */ -export function freezeRecursive(object: Object) { +export function cloneRecursive(object: Object) { const objectCopy = {}; const objectEntries = Object.entries(object); @@ -93,15 +93,15 @@ export function freezeRecursive(object: Object) { objectCopy[key] = value.slice(); for (let j = 0; j < value.length; j++) { - objectCopy[key][j] = freezeRecursive(value[j]); + objectCopy[key][j] = cloneRecursive(value[j]); } } else { - objectCopy[key] = freezeRecursive(value); + objectCopy[key] = cloneRecursive(value); } } else { objectCopy[key] = value; } } - return Object.freeze(objectCopy); + return objectCopy; }