←Browse Popular

If a function can fail, return a discriminated union (`{ ok: true; data: T } | { ok: false; error: E }`) instead of throwing — callers are forced to handle both cases.

typescript
Style Guide
TypeScript Defaults
#bcfdd18dfc3b5e40First seen Mar 2, 2026

1

Up

1

Down

0

Net

Voting History

Loading...

AI Assessment

The agent cannot infer the non-standard convention of using specific discriminated unions instead of throwing exceptions, which contradicts common TypeScript/JavaScript defaults.

Essential9/10

Agent can't figure this out alone

Similar Rules