Skip to content

Instantly share code, notes, and snippets.

View Shishir435's full-sized avatar
🎯
Focusing

Shishir Shishir435

🎯
Focusing
View GitHub Profile
@Shishir435
Shishir435 / try-catch.ts
Created March 20, 2025 11:12 — forked from t3dotgg/try-catch.ts
Theo's preferred way of handling try/catch in TypeScript
// Types for the result object with discriminated union
type Success<T> = {
data: T;
error: null;
};
type Failure<E> = {
data: null;
error: E;
};