Hacker News new | past | comments | ask | show | jobs | submit | alcuadrado's comments login

You can use typescript as jsdoc annotations


Can you please expand further? If I annotated my js, how would the browser check and enforce my types? Would the checks include js-to-js code? What is the js script that I should include at the top of my <head>?


> how would the browser check and enforce my types?

If this is what you're looking for, you aren't going to get it with TypeScript, even if you could parse it in the browser. It might be possible to port or build a TypeScript parser that runs in the browser (it might even be done already) but this would mean sending a LOT of code over the wire for something that was designed as a static analysis tool.

You can use runtime validation libraries like https://zod.dev/.

JS will eventually include its own type system so that you will be able to write typed code and have it run in the browser. However, even then the types won't be checked at runtime. You'll still have to rely on a tool like `tsc` to type check your code.


I’m guessing what’s documented here:

https://www.typescriptlang.org/docs/handbook/jsdoc-supported...

I’ve never written TypeScript myself so just a guess.

There’s also this for node.js:

https://github.com/TypeStrong/ts-node


yes


> Derrick Rossi doesn’t quite see it this way, but he kind of saved the world. > > In 2008, he began researching messenger RNA (mRNA), building on the long-ignored work of Hungarian researcher Katalin Karikó

What?! Katalin Karikó is an SVP at BioNTech, the lab that created Pfizer's vaccine.



This reminds me to this email from LuaJIT's list:

Computers are fast, or, a moment of appreciation for LuaJIT https://groups.google.com/forum/#!msg/snabb-devel/otVxZOj9dL...


As an Indie Shuffle user, I feel happy for you!


This has been my most recommended book lately.


Most formal languages are created with an specific purpose, so there isn't simply a "best" one. You normally use tons of them in academia, and many times simultaneously.

If you give more information about what you are looking for, we may be able to help you.

If you just want to learn something interesting though, I'd say typed lambda calculus is a great option.


Also, I'd like to see statistics about how much of Flatiron-like schools and traditional schools graduates manage to get above-avarage salaries in their field. Comparing with other fields makes little sense.


The performance seriously decreases. I haven't measure how much, but I guess it'd only work for very very small scripts.



once the eval() invocation is complete and the code generated/compiled the performance should be the same as the code normally written. Basically it's only compiler from []{}!+ to javascript.


However, your js files would get really big, and download latency could actually be a performance drop.


True, however they should be very well compressible by 'deflate' too, the main concern is the initial parsing grok by the JIT. Yet, on runtime the scripts will be good as any.


The author here: as mentioned in the article, it started as part of a security research, but once started I couldn't help myself from pushing it further and see how far I could get. So I guess it's curiosity and a fun mental exercise, and maybe probing yourself that you can do something that you thought was impossible.


Consider applying for YC's Summer 2025 batch! Applications are open till May 13

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

Search: