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:
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.
Playground Link
TypeScript Version: 4.1.0 (probably all)
Search Terms: readystatechange, ProgressEvent
Code
Expected behavior:
For
readystatechangeevent, when calling fromdocument.addEventListenerthere is only single event target allowed and that is Document itself.Spec:
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.
Playground Link