Hacker Newsnew | past | comments | ask | show | jobs | submit | gojpeg's commentslogin

Here is my holiday project attempting to cover the most performance and type safety critical projects that consume JSON APIs with a code generator that produces drop-in strict TS code. It takes your API type declaration and spits out a small TS function that ensures a given value satisfies the type (a type predicate).

Why do I think we need another runtime type checking solution? Mostly because in high traffic projects it's harder to introduce another runtime dependency, set aside a TS plugin. Thus this tool simply generates tiny TS files you can check into your repo and start verifying the received data changing nothing in your build pipeline. CLI is available too though.

The predicate functions don't throw, so you can start by only checking the data and logging if something doesn't match. The produced code is JIT and minification friendly.

It's beta. Let me know what do you think about the tradeoffs I'm making! Does it click?


I have been waiting for docker, docker-machine and especially docker-compose to get mature enough for such a cool feature like infinite demo servers (*.demo.example.com) or A/B testing (ab1.example.com) could be done w/o anything else but a simple 30 lines bash script.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: