From 34a5b08536cdee2b234f3f4e16d6632aa0744646 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Thu, 16 Mar 2023 14:24:27 +0100 Subject: [PATCH] docs: improve typings, add error message --- Models/ThemeConfig/Json/LayerConfigJson.ts | 7 +++++-- Models/ThemeConfig/TagRenderingConfig.ts | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Models/ThemeConfig/Json/LayerConfigJson.ts b/Models/ThemeConfig/Json/LayerConfigJson.ts index 69e132e8a..4baee1063 100644 --- a/Models/ThemeConfig/Json/LayerConfigJson.ts +++ b/Models/ThemeConfig/Json/LayerConfigJson.ts @@ -303,8 +303,11 @@ export interface LayerConfigJson { */ tagRenderings?: ( | string - | { builtin: string | string[]; override: Partial } - | { id: string; builtin: string[]; override: Partial } + | { + id?: string + builtin: string | string[] + override: Partial + } | QuestionableTagRenderingConfigJson | (RewritableConfigJson< ( diff --git a/Models/ThemeConfig/TagRenderingConfig.ts b/Models/ThemeConfig/TagRenderingConfig.ts index a20011d74..1bd4149da 100644 --- a/Models/ThemeConfig/TagRenderingConfig.ts +++ b/Models/ThemeConfig/TagRenderingConfig.ts @@ -335,6 +335,10 @@ export default class TagRenderingConfig { if (allKeys.length > 1 && !allHaveIfNot) { throw `${context}: A multi-answer is defined, which generates values over multiple keys. Please define ifnot-tags too on every mapping` } + + if (allKeys.length > 1 && this.freeform?.key !== undefined) { + throw `${context}: A multi-answer is defined, which generates values over multiple keys. This is incompatible with having a freeform key` + } } }