NHacker Next on Rails
  • top
  • new
  • best
  • ask
  • show
  • jobs
login
GuidelinesFAQListsAPISecurityLegalApply to YCContact

Hacker News on Rails, powered by React on Rails Pro. Open the source on GitHub by ShakaCode.

Commit 06fc0df

Rendered at 09:05:25 GMT+0000 (Coordinated Universal Time) with Rails + React on Rails RSC.

Show HN: ArkType 3.0 – Set-theoretic precompiled TS validator (arktype.io)

51 points by ssalbdivad 1d ago | 15 comments

aaryanptl 2h ago
hey, this looks great, but first time got to know about this, can you tell me what is the one reason to use it over zod?
andon 1d ago
ArkType is easily one of my favourite TS libraries out there, solely because of it'a actually working subtype checking. Hugely undervalued! I'm working on a Cpp project, and was trying to find a library that did that.. Either I couldn't find it, or none existed that were to my liking. That made me wonder: Why aren't don't more web-libraries have a core written in Cpp, Rust, or anything else that compiles to wasm, so it can be used both natively and the web?

I ended up writing my own solution, in some ways more limiting than ArkType, in others better fitting my exact problem.

faangguyindia 1d ago
LLMs tend to be comparatively worse at TypeScript, JavaScript, and Python compared to Rust, which has far less code in the training corpus.

In our test we found rust > java/c# > php > python > go > javascript

jadbox 1d ago
ArkType is one of my favorite things in Typescript. It's elegent, reasonably terse, and fully utilizes the capabilities of Typescript to do things that is nearly impossible in other languages to do safely.
ssalbdivad 1d ago
thanks so much :-)
Benjamin_Dobell 1d ago
I tried ArkType a couple of years ago and really like the idea but ran into limitations pretty fast compared to the TypeScript compiler. Specifically, I make extensive use of mapped types to enforce through-out the codebase that introducing something new into the codebase immediately raises errors everywhere that new thing needs to be plugged in. Was already powerful for humans, but is even more so with LLMs. Has there been any movement on mapped types?
ssalbdivad 1d ago
you should check out the new .map() API:

https://arktype.io/docs/type-api#map

it's a really powerful API (could use some additional docs) both in terms of runtime and inference, curious to hear if it solves some of what you were looking for.

oever 13h ago
Is it possible to use Javascript Map everywhere instead of Object (or Record in typescript)? I recently 'upgraded' to typebox 1 and found that this mapping is now extremely slow because it's not precompiled.

Map is supposed to be better than Object and has a cleaner API. Yet it seems to be underused because loading JSON gives Objects.

Cu3PO42 1d ago
I'm particular excited for how well this plays with Bun's new AOT. One of the biggest hurdles for me where runtime codegen for type validation.
ssalbdivad 1d ago
totally, @ark/aot should produce much better artifacts for Bun AOT than any dynamic solution.
0x696C6961 1d ago
I've mostly stayed away from ArkType because of the compile times. But I wonder if that still makes sense with the Go rewrite.
ssalbdivad 1d ago
we actually built an entire type testing and benchmarking framework to help optimize arktype's type performance and accuracy, so we've certainly taken it seriously:

https://arktype.io/docs/attest

even before tsgo it could scale very far. at this point I would not expect it to be a bottleneck for almost anyone with how well the types scale with caching.

cptmurphy 1d ago
Great library but nowadays I use effect schema
question9876 1d ago
Is this related to ArkTS in any way?
ssalbdivad 1d ago
it is not and this is actually my first time learning of it!

I was already aware of an Ark UI in the ecosystem so I guess people just really like arks ¯\_(ツ)_/¯