Skip to content

Instantly share code, notes, and snippets.

View WhaleFell's full-sized avatar
🐱
Purring

WhaleFall WhaleFell

🐱
Purring
  • 223.220.134.188
  • 223.220.134.188
View GitHub Profile
@WhaleFell
WhaleFell / try-catch.ts
Created July 29, 2025 10:58 — 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;
};