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

Typescript is for me one of the most overengineered programming languages. Why did JS not follow the way python and php did? Integrate types in the main language but make it optional.


When typescript came out, you were seen as weird for wanting such a thing. I once had a VP of engineering dm me to tell me to stop discussing typescript in the company dev channel around 2015 (if you're reading this, that was a dick move). Nowadays you're kinda odd man out if you don't want types. So the idea of adding types even optional ones probably wouldn't have gone down well. The closest we ever came was es4 which of course never landed: https://evertpot.com/ecmascript-4-the-missing-version/


Thank god they didn't follow the way Python did.


Python keeps the types at runtime, that's why no TypeScript framework will have a developer experience anywhere near something like FastAPI.


It's doable if you really want to: https://docs.nestjs.com/openapi/cli-plugin#overview

(Also doable without a compiler step, but since it's TS one more compiler step isn't the end of the world: https://docs.nestjs.com/techniques/validation#auto-validatio...)


I do use this. It's not as seamless as using FastAPI. Also not as type-safe as FastAPI.

You can simply type a class variable as an int while the validation decorator works on a completely different type. It's an illusion of type safety.


First party runtime types would be nice, but zod has become pretty much the standard answer for projects that need it. Not complicated.


Tell me how to have automatic documentation and validation like FastAPI using anything in Node.js and I will use it immediately.

Note: NestJS isn't it.


Do OpenAPI Swagger docs count? That seems to be the route a ton of the ecosystem takes.

trpc, ts-rest, and express-zod-api all explicitly build on zod and can do validation + Swagger UI generation.

hono looks like it doesn't do that by default, but single-source-of-truth validation + Swagger UI are available as middleware via `@hono/zod-openapi`.


Typescript does support it. You can do everything ts can in js with just jsdoc style comments. I actually prefer it.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: