logoalt Hacker News

hollowturtleyesterday at 10:15 PM2 repliesview on HN

Interpreted that's right, in fact it's super slow and adding types adds up to parsing time. Javascript is jitted. Python types serves no purpose if not for documenting or letting the lsp doing some lightweight type checking. And btw typescript introduced many breaking changes and the spec is managed by microsoft something you don't want for the open web. What we would really benefinit from would be having WASM being able to do more inside the browser, like rendering, managing user input, accessibility, dom manipulation. Then u could compile your favorite static types lang down to wasm. Hell even a strictier version of TS could be made to do that, iirc there's something similar called assembly script


Replies

ngrillytoday at 10:31 AM

Python type annotations are available at runtime, which can be used for serialization and validation (for example in FastAPI).

sirsinsalottoday at 12:16 AM

I mean, all typescript does is serve no purpose except for an LSP and documenting type intention really. It isn't much different to Python type annotation.