Open eyeseast opened 1 year ago
We probably want to write this in TypeScript and include types that the DocumentCloud frontend can use.
Once this has its own repo, probably want to make a dedicated project board for it, too.
Looking at Svelte's approach, this seems eminently reasonable: https://news.ycombinator.com/item?id=35892250
It looks like all the files are JS, so imports work as normal and everything works without a build step, while types get defined in separate definition files like this one: https://github.com/sveltejs/svelte/blob/master/packages/svelte/src/compiler/interfaces.d.ts
The JSDoc approach looks like it also solves this problem: https://stackoverflow.com/questions/62619058/appending-js-extension-on-relative-import-statements-during-typescript-compilat
Let's build a standalone javascript client for the DocumentCloud API. We can start by extracting some of the code uses in the new Add-Ons UI, since it's built on native
fetch
. Ideally, this library should work in all javascript environments: the browser, NodeJS and Deno.