maplibre-gl-js icon indicating copy to clipboard operation
maplibre-gl-js copied to clipboard

`RequestTransformFunction` `resourceType` argument allows `undefined` but it isn't clear what this means, beause there's also `ResourceType.Unknown`

Open JannikGM opened this issue 9 months ago • 5 comments

The typing is here:

https://github.com/maplibre/maplibre-gl-js/blob/be14c414d896ca0c3fd71d37c93bc65a157fdedb/src/util/request_manager.ts#L21

The ambiguity (Unknown being an allowed value) is here:

https://github.com/maplibre/maplibre-gl-js/blob/be14c414d896ca0c3fd71d37c93bc65a157fdedb/src/util/request_manager.ts#L6-L15

If undefined means the same as ResourceType.Unknown then I'd suggest to make this a mandatory argument (so transform-request handlers don't have to convert undefined to ResourceType.Unknown on their own). If those two aren't the same, then it should be documented what it means.

This caused an issue in another project for me: https://github.com/rowanwins/maplibregl-mapbox-request-transformer/issues/7

JannikGM avatar Oct 09 '23 12:10 JannikGM