- Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
Bug Report
🔎 Search Terms
🕗 Version & Regression Information
- This is something that I expected to work after 4.3's Contextual Narrowing for Generics
⏯ Playground Link
Playground link with relevant code
💻 Code
declareconsteventType: keyofDocumentEventMap;document.addEventListener(eventType,(event)=>{event;// Here `event` is `Event | UIEvent | AnimationEvent | MouseEvent | InputEvent | FocusEvent | CompositionEvent | ... 9 more ... | ClipboardEventif(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.
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created