DefinitelyTyped / DefinitelyTyped/DefinitelyTyped

'@types/mapbox-gl': Property 'setData' does not exist on type 'Source'

Open
#14,877 17 comments 11 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
51.4k
Forks
30.4k
Avg merge
3d 21h
Merged PRs (30d)
108

Description

I tried using the @types/mapbox-gl package v.0.29.1 and had problems.

Since last Aug, we are to use map.getSource(...).setData(...) to update GeoJSON sources.
(https://github.com/mapbox/mapbox-gl-js/blob/master/CHANGELOG.md#0220-august-11-2016)

Also documented in the API docs:
https://www.mapbox.com/mapbox-gl-js/api/#GeoJSONSource

However, I'm getting the following Typescript error when trying to implement:
TS2339:Property 'setData' does not exist on type 'Source'

I'm not sure how to update or fix this...

  • Authors: @dobrud, @alex3165, @andy-ms

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the @types/mapbox-gl v0.29.1 Source definition with the mapbox-gl GeoJSONSource API documentation linked in the issue. The work is done when TypeScript accepts getSource(...).setData(...) for GeoJSON sources without TS2339.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.