Oddbean new post about | logout
 I wrote an http client library from scratch at 4am 
 ...why? 
 Tired of being stuck in 2017 with Axios and xhr. I want new things to be based on Fetch API. A lot of code depends on it so I want to change it now. Couldn't get past this in the "best" existing library: https://github.com/sindresorhus/ky/pull/606 Wasn't worth forking it when I need only a fraction of the functionality anyway. So I wrote this instead: https://gitlab.com/soapbox-pub/soapbox/-/blob/main/src/api/MastodonClient.ts?ref_type=heads Honestly not bad, but it took way longer to figure out than it looks. 
 Neat, I wrote something similar once for https://github.com/xyzshantaram/colle 
 How dare you put a .js file in a TypeScript project 
 Because then i can do this directly in the browser:
```
import { Colle } from "https://deno.land/x/colle@2.1.1/src/Colle.js"
```
(https://github.com/tc39/proposal-type-annotations when? 😔 ) 
 That type annotations thing is needed badly. I was just thinking about it. 
 No I think he means:  why stop short of rolling your own TCP? 
 Honestly when he said "http client" I immediately thought he wrote something that talks raw http and not a client in the sense of axios etc