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
{{ message }}
Repository navigation
AddEventListenerOptions not available in Document, HTMLDivElement and others #18136
addEventListener has now an object third param type. Some were included in #15183 (closing #14188 )
But this is not fixed for Document and others in TS 2.4.1 (and ts playground)
document.addEventListener('readystatechange', function () { }, { once: true });
document.createElement('div').addEventListener('click', function () { }, { once: true });
Update: HTMLDivElement extends HTMLElement (with own addEventListener for special this) HTMLElement extends Element (with own addEventListener for special this) Element extends Node (with own addEventListener for special this) Node extends EventTarget EventTarget (with addEventListener with unspecific this)
microsoft/TypeScript-DOM-lib-generator#312 (ported in #19426) added an own removeListener to document which overwrites the working signature from EventTarget with the "buggy" one without the options.
document.removeEventListener('keydown', myHandler, options);
compiles in TS2.5 but not in TS2.6
Mohamed Hegazy (@mhegazy) Do you see any reason to not just emit the useCapture?: boolean|AddEventListenerOptions in the generator? There are also a handful of types which add signatures through addedTypes that need to be updated, but I think I will make this change and submit another pull request.
Activity
mhegazy commentedon Aug 30, 2017
PRs welcomed. You can find more information about contributing lib.d.ts fixes at https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md#contributing-libdts-fixes.
HolgerJeromin commentedon Oct 26, 2017
Mohamed Hegazy (@mhegazy) Adam Hines (@thebanjomatic)
The current state now in master is a breaking change in TS2.6
microsoft/TypeScript-DOM-lib-generator#312 (ported in #19426) added an own removeListener to document which overwrites the working signature from EventTarget with the "buggy" one without the options.
document.removeEventListener('keydown', myHandler, options);compiles in TS2.5 but not in TS2.6
thebanjomatic commentedon Oct 26, 2017
Mohamed Hegazy (@mhegazy) Do you see any reason to not just emit the
useCapture?: boolean|AddEventListenerOptionsin the generator? There are also a handful of types which add signatures through addedTypes that need to be updated, but I think I will make this change and submit another pull request.adding [Add]EventListenerOptions parameter for generated signatures
adding [Add]EventListenerOptions parameter for generated signatures