Html element onerror eventhandler override
This PR fixes https://github.com/Microsoft/TypeScript/issues/62075.
Originally, I created this https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/2148#issuecomment-3289858315, but closed it as the that approach wasn't ideal.
I started with Omit<GlobalEventHandlers, 'onerror'> as an approach. However, I quickly realized it isn't the correct path and creates a whole slew of new problems due to how event handlers are mapped to different elements during the emit phase. (if you're curious to see what exactly I ran into, I can push up a separate PR).
What this change does:
Introduces a new type DocumentOrGlobalOnErrorEventHandler which extends the OnErrorEventHandlerNonNull type with HTMLElement specific handlers. This type then overrides GlobalEventHandlers onerror property. This allow us to be backwards compatible and fix the bug.
This did require a change to both types.ts and emitter.ts so that exposed was accounted for when creating a new typedef. I needed the new DocumentOrGlobalOnErrorEventHandler to only be exposed on the dom library.
The onerror of GlobalEventHandlers cannot be overridden by the overrideType.ts file. I tried to a few times, in both mixin-ins and interfaces. It turns out it has to be overidden in the patches/events.kdl file.
Let me know if I missed anything or another approach would be better. I think this threads the needle nicely as it works only on dom elements and still provides both the global and HTMLElement specific onerror handling types.
Thanks for the PR!
This section of the codebase is owned by @saschanaz - if they write a comment saying "LGTM" then it will be merged.
This one is ready for review @saschanaz.