AutumnA
Autumn9mo ago
46 replies
Wildan

small type dx: maybe nice if we use

small type dx: maybe nice if we use union for the return

type Success<T> = {
  data: T
  error: null
}

type Failure<E> = {
  data: null
  error: E
}

type Result<T, E = Error> = Success<T> | Failure<E>
image.png
Was this page helpful?