2 ms·
> That IMHO is the weakest link in the TS backend ecosystem, compiler plugins to convert TS types to runtime types are really needed. Just define all your type
by simlevesque 11mo ago
> That IMHO is the weakest link in the TS backend ecosystem, compiler plugins to convert TS types to runtime types are really needed.
Just define all your types as TypeBox schemas and infer the schema from that validator. This way you write it once, it's synced and there's no need for a compiler plugin.
https://github.com/sinclairzx81/typebox?tab=readme-ov-file#usage https://github.com/sinclairzx81/typebox?tab=readme-ov-file#u...
- com2kid 11mo agoThat is nice and all, but it is one of many libraries that solves a problem that shouldn't exist. The TS compiler should either have an option to pop out JSON schema from TS types or have a well defined plugin system to allow that to happen. TS being compile time only really limits the language. It was necessary early on to drive adoption, but now days it just sucks.