TypeScript
Status: 🌱
Motivation
Create safer application layers with strong typing across frontend and backend boundaries.
Connections
Starter Points
- Enforce strict compiler settings and avoid implicit
any. - Define shared contract types for API requests/responses.
- Improve runtime validation at external boundaries.
Exception Handling
- In
catch, preferunknownoveranyso type checks are required before property access. - Use narrowing (
instanceof, custom type guards) before reading error fields. - Rethrow errors you are not explicitly handling; only swallow known, intentional cases.
try {
// ...
} catch (err: unknown) {
if (err instanceof ConnectionError && err.response?.code === 400) {
isValid = false;
return;
}
throw err;
}