Skip to content

MapEvents originalEvent type issue #13566

Description

@N1cc3

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:

	"zoomstart": {
		originalEvent?: WheelEvent | TouchEvent;
	} | void

Fixed:

	"zoomstart": {
		originalEvent?: WheelEvent | TouchEvent;
	}

Steps to trigger the unexpected behavior

const map = new mapboxgl.Map({ container: 'map' })
map.on('zoomstart', (e) => {
  console.log(e.originalEvent) // <-- Type error
})

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions