I'm trying to determine the size of an image using JavaScript, but I encountered a TypeScript error:
const img = new Image();
img.onload = function() {
alert(this.width + 'x' + this.height);
}
img.src = 'http://www.google.com/intl/en_ALL/images/logo.gif';
How to get image size (height & width) using JavaScript?
Property 'width' does not exist on type 'GlobalEventHandlers'.
Any suggestions on how to resolve this issue?