Skip to content

Comment on ArkType: Ergonomic TS validator 100x faster than Zodparent

Comments

The alternative would be to use a different programming language altogether. In programming languages that have built-in static types, parsing JSON works differently. It’s not possible to lie to the compiler so that a variable declared to be a string actually contains something else. You have to use a parser that will construct the specific type you want.

The closest thing to JavaScript would probably be Dart, now that it has sound types [1].

You’re right that it’s a pain in some situations.

[1] https://dart.dev/language/type-system

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.