Skip to content

Comment on Running TypeScript Natively in Node.js

Comments

This is great to finally see get added. I wonder why they decided to build their own type stripper instead of just bundling tsc/swc. It feels like Node.js is going to be plagued with bugs whenever TypeScript adds new type constructs, which may take months to get patched.

Would it be possible for the maintainers of Typescript to provide an official stripper that could be deployed alongside new versions of Typescript, and then snapped in?

I'm not certain but I would be surprised if the TS and Node devs didn't discuss the functionality that's in Node now, since TS must have some definition of what an erasable type is (or rather, what few features aren't erasable, like enums), since the corresponding --erasableSyntaxOnly flag in TS was probably made specifically because of Node.

Its just stripping types, so new constructs should not matter - there is no parsing.

It uses swc under the hood.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.