Loading video...

Video Failed to Load

Go Home

TIL that TypeScript can detect 'break' clauses in while (true) loops. Pretty freaking cool.

54,548 views • 1 year ago •via X (Twitter)

10 Comments

Erik's profile picture
Erik1 year ago

Wow they solved the halting problem

Sahaj Jain's profile picture
Sahaj Jain1 year ago

TIL that TypeScript also supports break with labelNames

ᴛᴏʟʟʏ ( ͡° ͜ʖ ͡°)'s profile picture
ᴛᴏʟʟʏ ( ͡° ͜ʖ ͡°)1 year ago

what if you change 0.5 to 1?

0xAlice (e/tard)'s profile picture
0xAlice (e/tard)1 year ago

😭😭😭

Matt Pocock's profile picture
Matt Pocock1 year ago

?

Tiger Abrodi's profile picture
Tiger Abrodi1 year ago

I kind of expected this though What would be interesting is if it can narrow down e.g. based on a value, so in a while loop, if we I don't know, hit the value 5, then we return Otherwise we continue If it knows that That'd be even more badass

Samual Norman 🦋 @samual.uk's profile picture
Samual Norman 🦋 @samual.uk1 year ago

TypeScript's control flow analysis is the best I've seen in any language

Prasenjit's profile picture
Prasenjit1 year ago

That's a pretty cool trick for sure, thanks for sharing about it. it's going to help a lot.

Jaid's profile picture
Jaid1 year ago

How much effort does it put into determining whether the break statement itself is reachable?

0xAlice (e/tard)'s profile picture
0xAlice (e/tard)1 year ago

this is like, the whole idea behind the never type. man oh man ...

Related Videos