-
Notifications
You must be signed in to change notification settings - Fork 12.8k
DOM's Event is not extensible via class syntax #17156
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
Comments
Essentially a duplicate of the issue in #10853, right? Are you trying to target ES5? |
Essentially yes. Built-ins are not extensible in ES5. It was not something that was introduced until ES2015. There is no down-emit that would work. |
@kitsonk I'm not really sure what this has to do with ES2015 - this is not a built in - it's a host object. Whether or not it can be extended is up to the DOM and not JavaScript. |
Also see #11304 |
Yes, this issue looks like a duplicate of #11304 - although that one is about an ES built in and this one is about the DOM. |
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
TypeScript Version: 2.3.4
Code
Expected behavior:
Code compiles and runs.
Actual behavior:
Code compiles, but Event has a runtime check that prevents calling it directly (without new). This means that TypeScript's compiled code:
Will throw at the marked line, because
_super
can't be.call
ed directly.With normal JS classes, the exact same code (sans the type annotations) work as expected.
P.S. I know that you're supposed to use
CustomEvent
with thedetails
property, but that's not supported in IE or Safari, and we sadly need those browsers, and while it could be resolved with a polyfill forCustomEvent
, this is still a piece of code that works with plain JS but does not run with TS compilation.The text was updated successfully, but these errors were encountered: