Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

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

54,548 Aufrufe • vor 1 Jahr •via X (Twitter)

10 Kommentare

Profilbild von Erik
Erikvor 1 Jahr

Wow they solved the halting problem

Profilbild von Sahaj Jain
Sahaj Jainvor 1 Jahr

TIL that TypeScript also supports break with labelNames

Profilbild von ᴛᴏʟʟʏ ( ͡° ͜ʖ ͡°)
ᴛᴏʟʟʏ ( ͡° ͜ʖ ͡°)vor 1 Jahr

what if you change 0.5 to 1?

Profilbild von 0xAlice (e/tard)
0xAlice (e/tard)vor 1 Jahr

😭😭😭

Profilbild von Matt Pocock
Matt Pocockvor 1 Jahr

?

Profilbild von Tiger Abrodi
Tiger Abrodivor 1 Jahr

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

Profilbild von Samual Norman 🦋 @samual.uk
Samual Norman 🦋 @samual.ukvor 1 Jahr

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

Profilbild von Prasenjit
Prasenjitvor 1 Jahr

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

Profilbild von Jaid
Jaidvor 1 Jahr

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

Profilbild von 0xAlice (e/tard)
0xAlice (e/tard)vor 1 Jahr

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

Ähnliche Videos