Yeah, so long as you have an else block that's the same type, you can define/assign to a variable that way. Certain ways of chaining them are currently unstable, but lots of flexibility. Kotlin also does this, btw.
Isn't that feasible using discriminated unions in TypeScript? Or for more complex cases type guards? π€
I feel like the downside is that it doesn't let you unwrap the value but I feel that's about it..? Or am I missing something obvious π€
www.typescriptlang.org/play/#code/K...
I only know C# and the Blueprint visual scripting system, is if let from C# or another language (from what I understand JavaScript is similar to C#, but I'm fairly new to programming and only started learning it for Gamedev)