Comment

Comment by vhakulinen

Regarding the error handling case, I've played around with the idea of implementing a Result type with typescript and hiding the errors behind that. The end result looks something like this

    const res = await getJSON('/thingy');

    if (isErr(res)) {
      // Handle error.
      return;
    }
You can read the details from here: https://thingsthatkeepmeupatnight.dev/posts/simple-typescrip...
parent vhakulinen 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton