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

toElement missing from MouseEvent in v3.6-beta/dev #32751

Closed
bre1470 opened this issue Aug 7, 2019 · 5 comments
Closed

toElement missing from MouseEvent in v3.6-beta/dev #32751

bre1470 opened this issue Aug 7, 2019 · 5 comments
Assignees
Labels
Needs Investigation This issue needs a team member to investigate its status. Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@bre1470
Copy link

bre1470 commented Aug 7, 2019

TypeScript Version: 3.6.0-dev.20190807

Search Terms: super parent property , super parent properties

Code

// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.
interface Obj extends PointerEvent {
}
let o: Obj;
if (o && (o.relatedTarget || o.toElement)) {
    console.log(':)');
}

Expected behavior:
Inherited toElement from MouseEvent should be recognized like relatedTarget.

Actual behavior:
Error: Property 'toElement' does not exist on type 'Obj'.

Playground Link:
Lacking v3.6.

Related Issues:
Unknown

@RyanCavanaugh RyanCavanaugh added this to the TypeScript 3.6.1 milestone Aug 7, 2019
@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Aug 7, 2019
@sandersn
Copy link
Member

sandersn commented Aug 7, 2019

@bre1470 can you explain how these are unstable? Do they vary over time as you interact with them in the editor?

(I hope they are just inconsistent, because it's usually a simpler bug in that case.)

@sandersn
Copy link
Member

sandersn commented Aug 7, 2019

@bre1470 I can't find toElement anywhere in the PointerEvent class hierarchy. It doesn't even show up in lib.dom.d.ts. Was it there on an older version of Typescript?

@sandersn sandersn changed the title Unstable recognition of super parent properties in v3.6-beta/dev toElement missing from MouseEvent in v3.6-beta/dev Aug 7, 2019
@sandersn sandersn added the Working as Intended The behavior described is the intended behavior; this is not a bug label Aug 7, 2019
@sandersn
Copy link
Member

sandersn commented Aug 7, 2019

Looks like toElement is an old IE property. lib.dom.d.ts doesn't include these anymore, so you may need a shim to provide them (or cast to any if you're just doing feature detection).

@sandersn sandersn closed this as completed Aug 7, 2019
@bre1470
Copy link
Author

bre1470 commented Aug 8, 2019

Thanks for the help! It was part of previous declarations (though with deprecated flag) and when I checked the declaration in the editor, it was still present - but this was pointing to editors declaration (3.5.1), what I obviously missed. Sorry for the false alarm.

@sod
Copy link

sod commented Oct 20, 2019

Chrome implements it for mouseenter & mouseleave events. It contains the element the cursor hit when the event emits. In case there is a mouseleave because the user enters a native element (like autosuggest dropdown) it contains null.

In firefox it's undefined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Investigation This issue needs a team member to investigate its status. Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

4 participants