原文
| ||||||||||||||||||
| ||||||||||||||||||
![]() |
原始链接: https://news.ycombinator.com/item?id=43665540
ArkType,一个定位为比Zod快得多的符合人体工程学的TS验证器,正在Hacker News上引发讨论。一位评论者强调了它独特的将TypeScript类型引入运行时的能力,使得能够以完全保真度地对类型进行编程操作,将其定位为Zod的潜在替代品。尽管对Zod v4的最新改进印象深刻,但这位评论者认为ArkType的范围更广,类似于一种数据建模语言。一个关键缺点是ArkType更大的运行时代码大小,这对于某些前端来说可能是个问题。但是,这位评论者预计预编译可以将ArkType转变为具有编译器的语言,使其适用于更轻量级的客户端。另一位用户指出了新发布的Zod v4承诺的性能提升。
| ||||||||||||||||||
| ||||||||||||||||||
![]() |
I've been evaluating schema libraries for a better-than-Zod source of truth, and ArkType is where I've been focused. Zod v4 just entered beta[1], and it improves many of my problems with it. For such a mature library to improve like this, v4 is treat and speaks volumes to the quality of engineering. But ArkType has a much larger scope, and feels to me more like a data modeling language than a library.
The main downside I see is that its runtime code size footprint is much larger than Zod. For some frontends this may be acceptable, but it's a real cost that isn't wise to pay in many cases. The good news is with precompilation[2] I think ArkType will come into its own and look more like a language with a compiler, and be suitable for lightweight frontends too.
[1] https://v4.zod.dev/v4
[2] https://github.com/arktypeio/arktype/issues/810
reply