Skip to content

Commit

Permalink
Fix typing of Map.getLayer() and Style.getLayer() (maplibre#2969)
Browse files Browse the repository at this point in the history
Fixes maplibre#2968

* Fix typing of Map.getLayer() and Style.getLayer()

* Update CHANGELOG.md

---------

Co-authored-by: Harel M <[email protected]>
  • Loading branch information
RoystonS and HarelM authored Aug 10, 2023
1 parent deb1276 commit e8bf0bd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

### 🐞 Bug fixes

- Correct declared return type of `Map.getLayer()` and `Style.getLayer()` to be `StyleLayer | undefined` to match the documentation.
- _...Add new stuff here..._

## 3.3.0
Expand Down
2 changes: 1 addition & 1 deletion src/style/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ export class Style extends Evented {
* @param id - id of the desired layer
* @returns a layer, if one with the given `id` exists
*/
getLayer(id: string): StyleLayer {
getLayer(id: string): StyleLayer | undefined {
return this._layers[id];
}

Expand Down
2 changes: 1 addition & 1 deletion src/ui/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2475,7 +2475,7 @@ export class Map extends Camera {
* @see [Filter symbols by toggling a list](https://maplibre.org/maplibre-gl-js/docs/examples/filter-markers/)
* @see [Filter symbols by text input](https://maplibre.org/maplibre-gl-js/docs/examples/filter-markers-by-input/)
*/
getLayer(id: string): StyleLayer {
getLayer(id: string): StyleLayer | undefined {
return this.style.getLayer(id);
}

Expand Down

0 comments on commit e8bf0bd

Please sign in to comment.