-
Notifications
You must be signed in to change notification settings - Fork 12.8k
TS 1.5.3 - Property 'attachEvent' does not exist on type 'Window' #3953
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
as for the workaround, what about (<any>window).attachEvent("onmessage", callback); |
This workaround should make it, thanks. ;) |
Sorry about that. i have added it to the breaking changes list. they are IE-specific and we have cleaned up most of these, to keep the library accurate. to get your code to work all you need is the defintiion for these, so include this in one of your files: // Add IE-specific interfaces to Window
interface Window {
attachEvent(event: string, listener: EventListener): boolean;
detachEvent(event: string, listener: EventListener): void;
} |
It makes sense! Thanks for the quick review and help, much appreciated! |
Just another thing, I just saw you made a spelling mistake in the breaking change page at
|
thanks! fixed. |
so how come all the global properties such as window.HTML_Any_Element do not exist in the Window interface? am I doing something wrong? |
@z-vr, this is not related to the OP. the standard lib does not model the DOM mapping of global object to window. if you want to add these you can define something like: interface Window {
HTMLDivElement: typeof HTMLDivElement;
} |
Hi , I have similar issue with my web application. uses web parts and Ajax. Below is the error:- Object doesn't support property or method 'attachEvent' Thanks |
Try |
@kmvan |
It is better to have definitions for missing functions. Currently it is not pushed to npm cause I don't know how much interest there is in such lib. |
i've written some collections for typescript globals.d.ts#L105 |
I've just updated from 1.4.1 to 1.5.3 and my compiler doesn't want to compile that kind of code.
It is not listed on the breaking changes: https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes
Any advice/workaround?
Thanks.
(that seems to be the only breaking change, keep up the good work guys, TS is just awesome!)
The text was updated successfully, but these errors were encountered: