
Show HN: Compiletime macro to auto generate fast validators for TypeScript types - vsroy
https://github.com/vedantroy/typecheck.macro
======
frompdx
Interesting. It wasn't that long ago that a team I was on was looking for a
way to do something similar in TS. In our case we wanted our types to generate
JSON schemas for ajv so we could do away with writing them by hand. This seems
accomplish a large part of what we needed at the time.

------
arciini
Does this macro need to be placed in the same file as the type itself? That's
what I suspect (given this is an eslint transform), and it's not a big
limitation, but it'd be helpful to know

~~~
vsroy
Yes, it must be placed in the same file as the type itself.

Side note: It is a Babel macro :)

