Post

The better I get at writing Typescript the more I worry this codebase will be entirely inaccessible to other programmers. Is there some other path to eloquent static typing that avoids becoming dense and mysterious to outsiders?

0 reposts2 likes

Friday I wrote something like InstanceType<typeof Gitlab> to inject a preconfigured gitbeaker API client. It worked but felt icky. Would a bit of syntactic sugar help, like maybe Instance<&:Gitlab>? Is the exported gitbeaker constructor violating some idioms that make it more awkward than usual?

Things feel *extra* icky when I gather up a bunch of cute little subtypes: 3️⃣ These are the two dozen webhook event schemas I care about here out of GitHub’s complete list 2️⃣ I’m using Pick<> to only include the fields we use 1️⃣ Oh and I’m mapping that to a list of event names as strings