Applies one paint property to a layer, from a dynamically-built paint record.
MapLibre 6 types setPaintProperty's second parameter as keyof AllPaintProperties
instead of the v5 string. Every caller here iterates Object.entries() over a
Record<string, unknown> produced by the style converters (toFillPaint,
styleRulesToPaint, …), whose keys come from PROFILE JSON at runtime — a nominal
key type cannot describe them, and no amount of typing upstream would, since the
profile is data and not code.
The cast therefore lives HERE, once, rather than at each call site: a single named
seam that says why it exists beats two silent as never scattered in loops. MapLibre
itself validates the property name and warns on an unknown one — this narrows the
type, it does not bypass a check.
Applies one paint property to a layer, from a dynamically-built paint record.
MapLibre 6 types
setPaintProperty's second parameter askeyof AllPaintPropertiesinstead of the v5string. Every caller here iteratesObject.entries()over aRecord<string, unknown>produced by the style converters (toFillPaint,styleRulesToPaint, …), whose keys come from PROFILE JSON at runtime — a nominal key type cannot describe them, and no amount of typing upstream would, since the profile is data and not code.The cast therefore lives HERE, once, rather than at each call site: a single named seam that says why it exists beats two silent
as neverscattered in loops. MapLibre itself validates the property name and warns on an unknown one — this narrows the type, it does not bypass a check.