axios integrates better with TypeScript interfaces, however, fetch (and well as node-fetch) has much more predictable output.
// Is it `string` or `Record<string, unknown>` (or `Blob`)?const{data}=awaitaxios.get('/api')// Nearly always `Record<string, unknown>`constdata2=awaitfetch('/api').then((r)=>r.json())
Also, fetch can be attached AbortController. I would be interested in a library built on top fetch.
I know there are superagent and ky, but I never really tried.
axiosintegrates better with TypeScript interfaces, however,fetch(and well asnode-fetch) has much more predictable output.Also,
fetchcan be attachedAbortController. I would be interested in a library built on topfetch.I know there are superagent and ky, but I never really tried.
What about?
Now
datais an array of objectsFruitActually, it's just a fake typing.
It depends on the "real" data, whether it gets
JSON.parse()or not.