Node.js is able to execute TypeScript files without additional configuration
1–10 of 275 posts
Re: Node.js is able to execute TypeScript files without additional configuration
#2Re: Node.js is able to execute TypeScript files without additional configuration
#3It looks like this works by stripping away the type information, so at best it saves you a transpilation pass and doesn't improve safety.
Re: Node.js is able to execute TypeScript files without additional configuration
#4Re: Node.js is able to execute TypeScript files without additional configuration
#5Re: Node.js is able to execute TypeScript files without additional configuration
#6Re: Node.js is able to execute TypeScript files without additional configuration
#7It looks like this works by stripping away the type information, so at best it saves you a transpilation pass and doesn't improve safety.
Re: Node.js is able to execute TypeScript files without additional configuration
#8It looks like this works by stripping away the type information, so at best it saves you a transpilation pass and doesn't improve safety.
I suspect this would only handle the most rudimentary and basic typescript files. Once you start using the type system more extensively I suspect this will blow-up in your face.
It's kinda a shame. What a missed opportunity to do it properly (rather than relying on third party plugins etc)
Edit: if you are just using typescript for type checking at build time (i.e. the most basic rudimentary typescript files) the sure fine this may help you. But typescript also generates JavaScript code for missing features e.g. proper class access modifiers, generics, interfaces, type aliases, enums, decorators etc etc. typescript generates JS code to handle all that, so you're going to have a bad time if node just replaces it with the space character at run time.
Re: Node.js is able to execute TypeScript files without additional configuration
#9It looks like this works by stripping away the type information, so at best it saves you a transpilation pass and doesn't improve safety.
To check types at runtime (if that can even be done in a useful way?) it would have to be built into v8, and I suppose that would be a whole rewrite.
Re: Node.js is able to execute TypeScript files without additional configuration
#10Impressed with what Node is doing the last years, deno and bun has really made Node focus and improve. It was stuck for a while
Last actually note-worthy improvement I heard of was properly supporting import/export (although do you still need to use the .mjs hack?), but I've been out of the loop here for sometime so would be nice to know what they've added since.