When I run a code:
public onResize(event: Event) {
console.log(event.target.innerWidth);
//--solution--
//var w = event.target as Window;
//console.log(w.innerWidth);
}
I receive an error:
Property innerWidth does not exist on type EventTarget
I would like to avoid extending types in TypeScript (as it is described here Property 'value' does not exist on type 'EventTarget' ), so I cast event.target
to Window
class. I'm not sure if I cast to proper class. Which class should I cast to? How to find out a proper class which should be cast to?