TypeScript-DOM-lib-generator icon indicating copy to clipboard operation
TypeScript-DOM-lib-generator copied to clipboard

'onclick' type of 'this' is wrong

Open Andy-MS opened this issue 7 years ago • 1 comments

document.body.onclick = function() {
    console.log(this.innerHTML.length);
}

The code works in a browser and worked in [email protected]. But in [email protected] it is a compile error:

src/a.ts:3:22 - error TS2339: Property 'innerHTML' does not exist on type 'GlobalEventHandlers'.

3     console.log(this.innerHTML.length);

The value of this should be HTMLElement like it was before, not GlobalEventHandlers. Detected in fabric and tingle.js on DefinitelyTyped.

Andy-MS avatar Aug 06 '18 17:08 Andy-MS

Hi, this still is present in v3.9.5, I found it with onchange....

latot avatar Sep 13 '20 04:09 latot