visgl / visgl/react-map-gl

[Bug] ViewStateChangeEvent typescript type missing originalEvent? in 8.0.0

Open
#2,484 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
8.5k
Forks
1.4k
Avg merge
5d 17h
Merged PRs (30d)
3

Description

Description

Previously, some callbacks (onMove, onMoveEnd, etc) could be attributed to a user event by the presence of an originalEvent property.

Those callback events still include an originalEvent property for user triggered callbacks (eg. dragging the map for onMoveEnd); however, the typescript type of the ViewStateChangeEvent does not include {originalEvent?: MouseEvent} in the type definition.

I'm uncertain whether the intention is to move away from the usage of that property; however, it's been a useful attribute.

Expected Behavior

ViewStateChangeEvent typescript type includes {originalEvent?: MouseEvent}

Steps to Reproduce

Reference event.originalEvent in code. Typescript error:

TS2339: Property originalEvent does not exist on type ViewStateChangeEvent

Environment
  • Framework version: react-map-gl@8.0.0
  • Map library: mapbox-gl@3.9.4
  • Browser:
  • OS:
Logs

No response

Contributor guide

Open the contributing guide

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 at modules/react-mapbox/src/types/events.ts around the ViewStateChangeEvent definition. Check the existing callback event types and reproduce the TS2339 error by referencing event.originalEvent. Done means the type exposes an optional MouseEvent originalEvent for the affected callbacks without changing their runtime behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.