Closed
Description
TypeScript Version: 2.7.0-dev.201xxxxx
I think was broken by #21889, and is not one of the changes listed as a fixed bug in the PR, so may be unintentional. The change has consequently has broken a handful of our RWC tests. Specifically, very common patterns like
Code
this._pseudoStatesToggle.addEventListener("DOMAttrModified", (mutationEvent: MutationEvent): boolean => {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '(mutationEvent: MutationEvent) => boolean' is not assignable to parameter of type 'EventListener'.
!!! error TS2345: Type 'boolean' is not assignable to type 'void | { handleEvent(evt: Event): void; }'.
return true;
});
The change is that the webworker lib file now defines EventListener
as:
type EventListener = (evt: Event) => void | { handleEvent(evt: Event): void; };
but it was:
interface EventListener {
(evt: Event): void;
}
There also used to be a type:
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
that some RWC tests rely on (and this type looks to be what the alias is emulating).