Remix.run Logo
joeriddles 10 hours ago

Great read. C# has the concept of nullable reference types[1] which requires you to be explicit if a variable can be null and the compiler is aware of this. I would love to see a similar feature in languages like TypeScript and Go.

[1]: https://learn.microsoft.com/en-us/dotnet/csharp/nullable-ref...

armchairhacker 9 hours ago | parent [-]

TypeScript has disctinct nullable and non-null types if you enable `strictNullChecks` or `strict` in TSConfig (https://www.typescriptlang.org/tsconfig/#strictNullChecks).

ygra 6 hours ago | parent [-]

In fact, part of the implementation (or at least ideas) were borrowed from TypeScript. Nullability in C# changes depending on the checks around the code (similar to how the type of expressions in ThpeScript can change depending on prior code).