From 17f59f8f9476f24d8e1dc381e527d777c53dab7f Mon Sep 17 00:00:00 2001 From: Nicolas Ayral Seydoux Date: Thu, 12 Dec 2024 11:00:14 +0100 Subject: [PATCH] Support undefined values for overriding --- src/type/CustomField.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/type/CustomField.ts b/src/type/CustomField.ts index 970e1e6f..235dce4f 100644 --- a/src/type/CustomField.ts +++ b/src/type/CustomField.ts @@ -25,7 +25,7 @@ export type CustomField = { /* The custom field name (this must be a URL). */ key: URL; /* The custom field value (this must be a literal). */ - value: string | number | boolean; + value: string | number | boolean | undefined; }; const WELL_KNOWN_FIELDS = [ @@ -68,7 +68,11 @@ export const toJson = ( `All custom fields keys must be URL objects, found ${field.key}`, ); } - if (!["string", "number", "boolean"].includes(typeof field.value)) { + if ( + !["string", "number", "boolean", "undefined"].includes( + typeof field.value, + ) + ) { // FIXME use inrupt error library throw new Error( `All custom fields values must be literals, found ${JSON.stringify(field.value)} (of type ${typeof field.value})`,