Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What good would that do with making sure a complex form has been filled out completely? Without a way to meaningfully attach error messages and so on, that only solves a small subset of the problems libraries like ArkType, Valibot, and Zod solve.


Look at how it’s done in Python, with Pydantic for example. The runtime information allows you to write plain typed functions (for example in FastAPI), and you can be 100% confident these are the types your function will actually receive at runtime, without having to write the types in a separate DSL. This is not possible in standard TS.


Well look at how the Python ecosystem squirmed real Pythonesque when adopting these type hints; and that's a packaged runtime that can just bump the major version and do a hard breaking change.

That doesn't work for JavaScript; you need full backwards compatibility at all times. Porting runtime type information to JS would change the language innards so much, it'd just be a different language in the end. At that point we could equally argue whether browser vendors should ship a Python runtime in browsers and add support for <script type="application/python">.




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

Search: