News for hackers. Stuff that matters.
Re:Better Promises in JavaScript by mikewhy on Monday September 24, 2018 @03:38PM (#18060734)
I've always just added an overload:

    function fetchText(input?: string | Request, init?: RequestInit) {
      return fetch(input, init).then(x => x.text())
    }

    function fetchJson(input?: string | Request, init?: RequestInit) {
      return fetch(input, init).then(x => x.json())
    }

There are no comments on this comment yet.