2 ms·
null/undefined is type checked in Typescript so the compiler will make sure you check whether your value is defined or not and handle it appropriately. Go havi
by madeofpalk 4y ago
null/undefined is type checked in Typescript so the compiler will make sure you check whether your value is defined or not and handle it appropriately.
Go having nullability isn’t the problematic part - it’s how nil is not type checked, so a value might secretly be nil and you won’t know until your program crashes at runtime.
Rust avoids this by just not having null, instead using things like Result and Option types, which is pretty neat with pattern matching.