I am encountering an issue with Typescript and I'm struggling to find a solution. While the code functions correctly when "compiled," I can't seem to resolve the error that keeps popping up. I have isolated the problematic parts of my code, but I'm unsure about how to address them effectively.
The error message appears in both the Editor and during the Gulp compile:
"Property 'src' does not exist on type 'HTMLElement'.at line 53 col 17"
...
element:HTMLElement; /* Defining element */
'''
this.element = document.createElement('img'); /*creating a img*/
'''
Rendering the element through this method works smoothly—the properties for position, top, and left function without triggering any errors.
display() {
this.element.src = this.file; /*This is the line that gives the error*/
this.element.style.position = "absolute";
this.element.style.top = this.pointX.toString() + "px";
this.element.style.left = this.pointY.toString() + "px";
document.body.appendChild(this.element);
};