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 type JSON from an external API safely?
ChatGPT
Parse, do not cast. A cast is a promise you cannot keep:
const User = z.object({ id: z.number(), email: z.string().email() });
type User = z.infer<typeof User>;
const user = User.parse(await res.json());
The runtime check is the point: as User compiles happily and fails at three in the morning instead.
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.