Chore: improve documentation and error messages

This commit is contained in:
Pieter Vander Vennet 2025-04-08 02:48:58 +02:00
parent 5095bffc50
commit 06a9fb3711
7 changed files with 26 additions and 19 deletions

View file

@ -151,7 +151,11 @@ export class Each<X, Y> extends Conversion<X[], Y[]> {
values[i]?.["id"] !== undefined ? values[i]?.["id"] : ""
)
}
const r = step.convert(values[i], c.enter(i))
let id = ""
if (values[i]?.["id"]) {
id = `(${values[i]?.["id"]})`
}
const r = step.convert(values[i], c.enter(i + id))
result.push(r)
}
return result

View file

@ -1,5 +1,5 @@
/**
* In some cases, a value is represented in a certain unit (such as meters for heigt/distance/..., km/h for speed, ...)
* In some cases, a value is represented in a certain unit (such as meters for height/distance/..., km/h for speed, ...)
*
* Sometimes, multiple denominations are possible (e.g. km/h vs mile/h; megawatt vs kilowatt vs gigawatt for power generators, ...)
*
@ -14,9 +14,9 @@
*
* # Usage
*
* First of all, you define which keys have units applied, for example:
* First of all, you define which keys have units applied. This can be done centrally in the layer:
*
* ```
* ```json
* units: [
* appliesTo: ["maxspeed", "maxspeed:hgv", "maxspeed:bus"]
* applicableUnits: [

View file

@ -197,7 +197,7 @@ export default class TagRenderingConfig {
json.freeform.key,
<any>Validators.availableTypes,
(s) => <any>s
)}`
)}. See https://source.mapcomplete.org/MapComplete/MapComplete/src/branch/develop/Docs/SpecialInputElements.md for more information`
}
const type: ValidatorType = <any>json.freeform.type ?? "string"