Problem: The backend returns a needlessly wide type


Problem: The backend returns a needlessly wide type.

Example: The backend returns null, undefined, or an array.

Solutions: (ranked by preferability):
1. Narrow the type on the backend.
2. Use Zod to narrow the type via default.

Now the array always exists.

View original on X