From e3a0a1dbcb00ea7cc0287a1bf29ced1fde99b81f Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Fri, 23 Aug 2024 11:45:03 +0200 Subject: [PATCH] Typing: make 'and' and 'or' in TagsFilter readonly --- src/Logic/Tags/TagUtils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Logic/Tags/TagUtils.ts b/src/Logic/Tags/TagUtils.ts index 354257fb9..3ce1a03e1 100644 --- a/src/Logic/Tags/TagUtils.ts +++ b/src/Logic/Tags/TagUtils.ts @@ -675,7 +675,7 @@ export class TagUtils { * TagUtils.containsEquivalents([new Tag("key","value")], [ new Tag("other_key","value")]) // => false * TagUtils.containsEquivalents([new Tag("key","value")], [ new Tag("key","other_value")]) // => false */ - public static containsEquivalents(guards: TagsFilter[], listToFilter: TagsFilter[]): boolean { + public static containsEquivalents(guards: ReadonlyArray, listToFilter: ReadonlyArray): boolean { return listToFilter.some((tf) => guards.some((guard) => guard.shadows(tf))) } @@ -731,7 +731,7 @@ export class TagUtils { } if (typeof json != "string") { if (json["and"] !== undefined && json["or"] !== undefined) { - throw `${context}: Error while parsing a TagConfig: got an object where both 'and' and 'or' are defined. Did you override a value? Perhaps use \`"=parent": { ... }\` instead of \"parent": {...}\` to trigger a replacement and not a fuse of values. The value is ${JSON.stringify( + throw `${context}: Error while parsing a TagConfig: got an object where both 'and' and 'or' are defined. Did you override a value? Perhaps use \`"=parent": { ... }\` instead of "parent": {...}\` to trigger a replacement and not a fuse of values. The value is ${JSON.stringify( json )}` } @@ -925,7 +925,7 @@ export class TagUtils { return 0 } - private static joinL(tfs: TagsFilter[], seperator: string, toplevel: boolean) { + private static joinL(tfs: ReadonlyArray, seperator: string, toplevel: boolean) { const joined = tfs.map((e) => TagUtils.toString(e, false)).join(seperator) if (toplevel) { return joined