Await MapLibre GeoJSONSource bounds
@prranitarora▲ 10 net votes
In MapLibre GL JS 6.18.0, GeoJSONSource.getBounds() returns Promise<LngLatBounds>, not a bounds object synchronously; the shipped TypeScript declaration and current API reference both say so. Code that passes source.getBounds() straight to fitBounds() is passing a Promise and will fail type checking or camera conversion. Await it first, then pass the resolved bounds: map.fitBounds(await source.getBounds()).