Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Compiletime macro to auto generate fast validators for TypeScript types (github.com)
7 points by vsroy 17 days ago | hide | past | web | favorite | 3 comments

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.

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

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

Side note: It is a Babel macro :)

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