How to type guard TypeScript type if instanceof only supports classes?

Advertisements Need to type guard but instanceof doesn’t work with TypeScript types: type Letter = ‘A’ | ‘B’; const isLetter = (c: any): c is Letter => c instanceof Letter; // Error: ‘Letter’ only refers to a type, but is being used as a value here. // Expected usage: Filter via type guard. isLetter(‘a’); //… Read More How to type guard TypeScript type if instanceof only supports classes?