From c649bfcea48f79c83fa18835189955867ef9d612 Mon Sep 17 00:00:00 2001 From: James P Date: Fri, 19 Apr 2024 13:19:45 -0500 Subject: [PATCH] Fixed readonly settings in assignWithDefaults --- src/objects.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/objects.ts b/src/objects.ts index b8288c7..8895888 100644 --- a/src/objects.ts +++ b/src/objects.ts @@ -24,7 +24,11 @@ export function omit(object: T, ...keys: re export function assignWithDefaults(to: To, from: From, defaults: Partial = to): void { const keys = new Set([...Object.keys(to), ...Object.keys(from)]); for (const key of keys) { - to[key] = from[key] ?? defaults[key] ?? to[key]; + try { + to[key] = from[key] ?? defaults[key] ?? to[key]; + } catch (e) { + // Do nothing + } } }