docs: improve typings, add error message

This commit is contained in:
Pieter Vander Vennet 2023-03-16 14:24:27 +01:00
parent ec2e0e1de1
commit 34a5b08536
2 changed files with 9 additions and 2 deletions

View file

@ -303,8 +303,11 @@ export interface LayerConfigJson {
*/ */
tagRenderings?: ( tagRenderings?: (
| string | string
| { builtin: string | string[]; override: Partial<QuestionableTagRenderingConfigJson> } | {
| { id: string; builtin: string[]; override: Partial<QuestionableTagRenderingConfigJson> } id?: string
builtin: string | string[]
override: Partial<QuestionableTagRenderingConfigJson>
}
| QuestionableTagRenderingConfigJson | QuestionableTagRenderingConfigJson
| (RewritableConfigJson< | (RewritableConfigJson<
( (

View file

@ -335,6 +335,10 @@ export default class TagRenderingConfig {
if (allKeys.length > 1 && !allHaveIfNot) { 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` 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`
}
} }
} }