Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix BaseEvent inheritance #2

Merged
merged 1 commit into from May 25, 2016
Merged

Fix BaseEvent inheritance #2

merged 1 commit into from May 25, 2016

Conversation

c9s
Copy link
Contributor

@c9s c9s commented May 24, 2016

This PR fixes the following errors:

(237,36): error TS2339: Property 'layerX' does not exist on type 'Event | BaseEvent'.
(236,56): error TS2339: Property 'layerY' does not exist on type 'Event | BaseEvent'.
(8,14): error TS2339: Property 'stopPropagation' does not exist on type 'Event | BaseEvent'.

@c9s
Copy link
Contributor Author

c9s commented May 24, 2016

For people who are looking for a workaround, here is the solution:

var e = <any>d3.event;

@PatrickJS PatrickJS merged commit a317138 into typed-typings:master May 25, 2016
@blakeembrey
Copy link
Member

I'm not sure BaseEvent is meant to extend Event. Do you have docs for this change?

The Event is the browser default event, while I believed d3 created it's own events with a sourceEvent pointing to the original event. If you know the event is an Event at that point in time, you should be using TypeScript for coercion - not changing the definition.

@c9s
Copy link
Contributor Author

c9s commented May 25, 2016

d3.event is a DOM Event. the following definition is from the d3 document:

 The d3.event object is a DOM event and implements the standard event fields like timeStamp and keyCode as well as methods like preventDefault() and stopPropagation().

@blakeembrey
Copy link
Member

Cool, thanks. Did you have a link to that? Should d3.event be updated to be event: BaseEvent instead of a union of types?

@doggy8088
Copy link

@blakeembrey https://github.com/d3/d3/wiki/Selections

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants