-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Type definition of CustomEvent constructor needs parameter(s). #2029
Comments
It looks like the |
@zhengbli is working on an updated library typings. I believe this should be handled by his change. so stay tuned. |
great--thanks! |
Is it in 1.5 alpha already? Because I cannot instance CustomEvent or even Event, this does not works: new CustomEvent('test'); |
This was not in 1.5-alpha but should be in the next release. you can find the updated lib.d.ts in https://github.com/Microsoft/TypeScript/blob/release-1.5/bin/lib.dom.d.ts |
Yep, thank you! I just wondered if it was already in alpha. |
Hmm.. just updated to beta version now I cannot use |
@NekR sorry about that. The issue is fixed in master, but did not make it in time for the beta. see #2953 for more details. it should be fixed in the next release. As a work around for now, you can copy the definitions of DataView from https://github.com/Microsoft/TypeScript/blob/master/src/lib/extensions.d.ts#L48 locally. |
@mhegazy I will copy it, thanks! But what about |
I am not sure i understand the issue with CustomEvent, this works file for me: var c: CustomEvent;
c.initCustomEvent("custom", true, false, undefined); |
This: var event = document.createEvent('CustomEvent');
event.initCustomEvent('test', true, true, void 0);
this.node.dispatchEvent(event); produces this error: This: var event:CustomEvent = document.createEvent('CustomEvent');
event.initCustomEvent('test', true, true, void 0);
this.node.dispatchEvent(event); produces this error: And only casting works: var event = <CustomEvent>document.createEvent('CustomEvent');
event.initCustomEvent('test', true, true, void 0);
this.node.dispatchEvent(event); First case worked just fine |
Type definition of CustomEvent constructor needs at least one parameter.
(The constructor of Event class also needs one parameter, actually.)
Since the current definition has no parameter, I encountered an error when I run a generated JS code by
Jasmine with node.
Following links are about CustomEvent class .
https://dom.spec.whatwg.org/#interface-customevent
https://developer.mozilla.org/en/docs/Web/API/CustomEvent
http://html5index.org/DOM%20-%20EventInit.html
http://html5index.org/DOM%20-%20CustomEventInit.html
I wrongly send a pull request #2007 on this issue.
Sorry about that.
The text was updated successfully, but these errors were encountered: