Skip to content

CustomEvent is missing for the list of specialized signatures on document.createEvent #2975

Closed
@mhegazy

Description

@mhegazy

Coppied from @NekR coment in: #2029 (comment)

This:

var event = document.createEvent('CustomEvent');
event.initCustomEvent('test', true, true, void 0);
this.node.dispatchEvent(event);

produces this error:
error TS2339: Property 'initCustomEvent' does not exist on type 'Event'.

This:

var event:CustomEvent = document.createEvent('CustomEvent');
event.initCustomEvent('test', true, true, void 0);
this.node.dispatchEvent(event);

produces this error:
error TS2322: Type 'Event' is not assignable to type 'CustomEvent'. Property 'detail' is missing in type 'Event'.

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 30 mins2 hours ago when I was on TS1.5-Alpha.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions