3 ms·
> I wonder why this isn't written in Typescript directly so as to handle documentation, validation and type definitions in one go. I suspect they want TypeSpec
by eyelidlessness 3y ago
> I wonder why this isn't written in Typescript directly so as to handle documentation, validation and type definitions in one go.
I suspect they want TypeSpec to be more runtime agnostic (as also tends to be the preference with TypeScript). Specifically to support arbitrary validation/serde.
Having written a fully integrated generalized solution (runtime-defined schema -> parser, types, documentation, serializer), by far my biggest regret the first time around is coupling it so closely to a particular schema runtime. Partly this is because I have bigger dreams for designing a schema system purpose built for the task (I had previously piggybacked on io-ts, which worked but it took considerable non-essential effort and complexity); partly it’s because there can be significant tradeoffs between different runtime solutions in terms of performance and ergonomics.