Closed as not planned
Description
TypeScript Version: 4.1.0 (probably all)
Search Terms: readystatechange, ProgressEvent
Code
document.addEventListener('readystatechange', event => {
if (event.target?.readyState === 'complete') {
// ready state
}
});
Expected behavior:
For readystatechange
event, when calling from document.addEventListener
there is only single event target allowed and that is Document itself.
Spec:
- https://html.spec.whatwg.org/multipage/indices.html#event-readystatechange
- https://developer.mozilla.org/en-US/docs/Web/API/Document/readystatechange_event
So code above should be executable without typescript errors.
Actual behavior:
Currently there is no information about event.target. It's pointing to generic event interface.