You
How do I model loading and error states without booleans?
ChatGPT
A discriminated union removes impossible states:
type State =
| { status: "idle" }
| { status: "loading" }
| { status: "ok"; data: User[] }
| { status: "error"; message: string };
With three booleans you can represent loading and error simultaneously; with this you cannot, and the compiler enforces handling each case.
You
Is turning on strict worth the errors it produces?
ChatGPT
Yes, incrementally. Turn on one flag at a time, starting with strictNullChecks, which finds the largest class of real bugs. Doing all of them at once produces a number so large that the team stops looking at it.
You
How do I know when it stops being worth it?
ChatGPT
When you stop noticing it. If it has not surfaced a problem in six months, it is either solved or it was never the bottleneck you thought.