[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.

Assessment

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

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.

Description

bug
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
Logs

No response

Dominant language
TypeScript
Stars
8.5k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Getting set up

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.

More from visgl/react-map-gl

All issues in visgl/react-map-gl

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.