logoalt Hacker News

antodyesterday at 10:18 PM1 replyview on HN

Python containing type hints doesn't get transpiled the way typescript does. The transpiling rewrites the TS to varying degrees depending on the target and the extra TS features being used.

Python "just" (that word is doing a lot of work) updated the interpreter to ignore the type hints. It still runs the same way as code without hints.

There's a bit more going on with TS that you couldn't just have the runtime ignore the types.


Replies

sirsinsalottoday at 12:17 AM

As I understand it you can, in fact node 23 has a type stripping feature. I could be wrong.