Exclude
Course: More Typescript APIs - chapter 6
In a function that can accept several types of inputs but you want to exclude specific types from being passed to it.
type Event = 'click' | 'scroll' | 'mousemove';type ExcludeEvent = Exclude<Event, 'scroll'>; // 'click' | 'mousemove'
const handleEvent = (event: ExcludeEvent) => { console.log(`Handling event: ${event}`);};
handleEvent('click'); // OK