Typesafe API Protection with TypeScript
github.com
Typesafe API Protection with TypeScript
1–3 of 3 posts
Re: Typesafe API Protection with TypeScript
#2Are there any other libraries that give good type-level guarantees?
Re: Typesafe API Protection with TypeScript
#3Are there any other libraries that give good type-level guarantees?
There are tons. The ones I most often see mentioned are: zod, io-ts, runtypes. I’m at the design stage of building yet another, not because the existing ones aren’t great, but because I have a different set of requirements that none really meet:
- Documentation-driven: types are defined by JSON Schema
- Automatically generated documentation (which you get for free with this design)
- Flexible API: some people prefer the io-ts FP style, others prefer try/catch; some prefer callable types, others prefer reference access for primitives like io-ts.
- Interfaces designed to integrate with an ecosystem of tools with a similar documentation-driven philosophy, for example an HTTP API library which automatically generates OpenAPI docs (which I’m also working on).