Truthyness was a bad idea. if (‘’) { may have seemed convenient in the 90s, but it’s much clearer to see .str.isNullOrEmpty(), etc.
Yes, null is bad, but in flow based typing and intersection types like TypeScript, unions allow the same protection as Option/Maybe without having to create a type for each pattern. Option, Error, Success, Union, etc,
const ref = useRef<HTMLElement | null>(null);
Vs
const ref = useRef<Option<HTMLElememt>>(null);