正在加载视频...
视频加载失败
Problem: I want to ensure my switch statement handles all potential cases. Solution: Use TypeScript's never type. Here's how:
11 条评论

Cory House1 年前
Full course with code for 20% off:

Alexander Mia1 年前
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 ↓

Pavel Svitek 🇨🇭1 年前
Great tip.. this is a really good lib to handle these kind of issues

Cory House1 年前
Feel unnecessary to me, but I can see how one might prefer it

Artem Zakharchenko1 年前
This is awesome!

Wildan1 年前
nice use of never. learned a new thing!

ً1 年前
should just do `pet satisfies never`

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

BDR1 年前
Great tip thanks!

Benjamin Scott1 年前
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

Niko E.1 年前
A realy good one.
