-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueRevisitAn issue worth coming back toAn issue worth coming back to
Milestone
Description
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.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issueRevisitAn issue worth coming back toAn issue worth coming back to
Type
Projects
Relationships
Development
Select code repository
Activity
CustomEvent
constructor #2007gdcohan commentedon Mar 31, 2015
It looks like the
Event
constructor has the same issue--should I file a separate ticket on that?mhegazy commentedon Mar 31, 2015
@zhengbli is working on an updated library typings. I believe this should be handled by his change. so stay tuned.
gdcohan commentedon Mar 31, 2015
great--thanks!
1 remaining item
NekR commentedon Apr 28, 2015
Is it in 1.5 alpha already? Because I cannot instance CustomEvent or even Event, this does not works:
mhegazy commentedon Apr 28, 2015
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
NekR commentedon Apr 28, 2015
Yep, thank you! I just wondered if it was already in alpha.
NekR commentedon Apr 30, 2015
@mhegazy
Hmm.. just updated to beta version now I cannot use
DateView
or invokeinitCustomEvent
onCustomEvent
because it says what it's justEvent
. I know I can download all these .d.ts files manually, but this does not seems right anyway.mhegazy commentedon Apr 30, 2015
@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.
NekR commentedon Apr 30, 2015
@mhegazy I will copy it, thanks! But what about
initCustomEvent
, is it fixed in master? I mean, for now of course I will useCustomEvent
since it's now exists with correct definition, but there are environments which do not supportsCustomEvent
it requiresinitCustomEvent
to be used.mhegazy commentedon Apr 30, 2015
I am not sure i understand the issue with CustomEvent, this works file for me:
NekR commentedon Apr 30, 2015
This:
produces this error:
error TS2339: Property 'initCustomEvent' does not exist on type 'Event'.
This:
produces this error:
error TS2322: Type 'Event' is not assignable to type 'CustomEvent'. Property 'detail' is missing in type 'Event'.
And only casting works:
First case worked just fine
30 mins2 hours ago when I was on TS1.5-Alpha.mhegazy commentedon Apr 30, 2015
Thanks @NekR. @zhengbli is fixing this now. we should have a working lib.d.ts for you to try soon. I have logged a different issue for is under #2975.