#exhaustive — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #exhaustive, aggregated by home.social.
-
TypeScript nicety. A variable's type is a union of classes:
declare const aorb: A | B
You want to handle each class separately with a sequence like
if (aorb instanceof A) { }
else if (aorb instanceof B) { }You also want to be sure that if another class is added you don't forget to amend the if-cascade. Just add:
else { throw aorb satisfies never; }
Full code on playground. Can this be done with switch too?
-
@RoundSparrow @suqdiq or people that just live to argue for the sake of argument.
Playing devil's advocate is an #exhaustive #exercise that has no end.
Can't do it, life's too short. I'll stick to my beliefs, you can keep yours. Whatever they are.
#ShariLewis #Song #TheSongThatDoesntEnd #LambChop #MuzakLessons