Skip to content

Instantly share code, notes, and snippets.

View didagu's full-sized avatar
😊
Creating Something EPIC !!

IDAGU DOMINIC IDOKO didagu

😊
Creating Something EPIC !!
View GitHub Profile
@t3dotgg
t3dotgg / try-catch.ts
Last active August 20, 2025 20:45
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;
};