Video yükleniyor...
Video Yüklenemedi
Problem: I want to ensure my switch statement handles all potential cases. Solution: Use TypeScript's never type. Here's how:
49,603 görüntüleme • 1 yıl önce •via X (Twitter)
11 Yorum

Full course with code for 20% off:

INTRODUCING: Agentic Security - LLM Security Scanner! 🔍 🔑 Features: Scans for prompt injections, jailbreaking & more. Provides detailed reports & options to customize attack rules. 🔗access the GitHub Link ↓

Great tip.. this is a really good lib to handle these kind of issues

Feel unnecessary to me, but I can see how one might prefer it

This is awesome!

nice use of never. learned a new thing!

should just do `pet satisfies never`

Or, if you have nested switch/if statements inside of your switch, use a Finite State Machine ;)

Great tip thanks!

Ah so that’s why “never” pops up every now and then To be honest, I’ve always hated seeing it but never understood it until recently

A realy good one.
