MapEvents originalEvent type issue
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
### mapbox-gl-js version
v3.15.0
### Expected behavior
The following MapEvents types has a optional `originalEvent` property:
- zoomstart
- zoom
- zoomend
- pitchstart
- pitch
- pitchend
### Actual behavior
The `originalEvent` inaccessible according to typescript.
Reason:
The listed events has a `| void` defined in the type.
Current:
```typescript
"zoomstart": {
originalEvent?: WheelEvent | TouchEvent;
} | void
```
Fixed:
```typescript
"zoomstart": {
originalEvent?: WheelEvent | TouchEvent;
}
```
### Steps to trigger the unexpected behavior
```typescript
const map = new mapboxgl.Map({ container: 'map' })
map.on('zoomstart', (e) => {
console.log(e.originalEvent) // <-- Type error
})
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the MapEvents type definitions for the listed zoom and pitch events and reproduce the TypeScript error with the callback shown in the issue. Update the event typing so the documented originalEvent property is accessible, then run the repository's type checks or relevant tests to confirm the callback compiles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100