You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I raised this on Codeplex; but I don't believe it's supported. I'm not sure which of the two referenced cases are most appropriate, so thought it best to raise as I'd posted originally. If this overlaps with an existing GH issue; please let me know.
It seems that TypeScript will not allow this code to be compiled, it expects an argument-free constructor. I cannot figure out how to extend/replace CustomEvent to allow it. There's an answer on SO that seems to explain why:
If the CustomEvent definition was purely an interface, you would be able to extend it thus:
(blah)
But the CustomEvent constructor is actually defined in a variable declaration, which you can't extend
My codebase is currently only around 40 lines of JavaScript, and already I can't make it work in TypeScript :(
I think TypeScript needs to be able to support things like this; Browsers will never have identical implementations and the specs are moving targets. We need to not have our hands tied by decelerations in lib.d.ts with the only way around them being to have a local hacked copy of lib.d.ts!
Note: I actually think the current CustomEvent decleration in TypeScript is kinda useless because Chrome doesn't even allow you to call "new CustomEvent()"; it'll crash. Even removing it completely and forcing me to declare it seems a better option than what we have now :-/
The text was updated successfully, but these errors were encountered:
I raised this on Codeplex; but I don't believe it's supported. I'm not sure which of the two referenced cases are most appropriate, so thought it best to raise as I'd posted originally. If this overlaps with an existing GH issue; please let me know.
Original Codeplex issue: http://typescript.codeplex.com/workitem/2531
I'm using the CustomEvent polyfill from here:
https://developer.mozilla.org/en/docs/Web/API/CustomEvent
DOM4 specifies a CustomError constructor that takes a string type and an (optional) custom data object:
It seems that TypeScript will not allow this code to be compiled, it expects an argument-free constructor. I cannot figure out how to extend/replace CustomEvent to allow it. There's an answer on SO that seems to explain why:
http://stackoverflow.com/questions/17571982/dispatching-custom-events
it says:
My codebase is currently only around 40 lines of JavaScript, and already I can't make it work in TypeScript :(
I think TypeScript needs to be able to support things like this; Browsers will never have identical implementations and the specs are moving targets. We need to not have our hands tied by decelerations in lib.d.ts with the only way around them being to have a local hacked copy of lib.d.ts!
Note: I actually think the current CustomEvent decleration in TypeScript is kinda useless because Chrome doesn't even allow you to call "new CustomEvent()"; it'll crash. Even removing it completely and forcing me to declare it seems a better option than what we have now :-/
The text was updated successfully, but these errors were encountered: