Bug Report
🔎 Search Terms
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
declare const eventType: keyof DocumentEventMap;
document.addEventListener(eventType, (event) => {
event; // Here `event` is `Event | UIEvent | AnimationEvent | MouseEvent | InputEvent | FocusEvent | CompositionEvent | ... 9 more ... | ClipboardEvent
if (eventType === `click`) {
event; // Expected: `event` to be type `MouseEvent`. Actual: It's the union from above.
}
});
🙁 Actual behavior
Second reference of event is type Event | UIEvent | AnimationEvent | MouseEvent | InputEvent | FocusEvent | CompositionEvent | ... 9 more ... | ClipboardEvent.
🙂 Expected behavior
Second reference of event to be of type MouseEvent.
Bug Report
🔎 Search Terms
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
Second reference of
eventis typeEvent | UIEvent | AnimationEvent | MouseEvent | InputEvent | FocusEvent | CompositionEvent | ... 9 more ... | ClipboardEvent.🙂 Expected behavior
Second reference of
eventto be of typeMouseEvent.