Hacker News new | ask | show | jobs
by epolanski 429 days ago
> it brings TS types into the runtime

So...it's a parser. Like Zod or effect schema.

https://effect.website/docs/schema/introduction/

1 comments

No, it's more like a type reflection system, at least as I understand it. You can use it to parse types, but you can also do a lot more than that.
Could you give an example or two of “more than that”?
Yeah, you can walk the AST of your types at runtime and do arbitrary things with it. For example, we're using ArkTypes as our single source of truth for our data and deriving database schemas from them.

This becomes very nice because ArkType's data model is close to an enriched version of TypeScript's own data model. So it's like having your TypeScript types introspectable and transformable at runtime.

TypeBox is similar by virtue of its goal of its runtime types matching JSON Schema's data model without need for conversion.
You can do whatever you want with the AST in effect schema too, it's a parser with a decoder/encoder architecture:

https://effect.website/docs/schema/transformations/

That's neat, thanks!