Node.js · Junior · Question 72 of 75
Can recent Node.js versions run a .ts file directly?
- 1No, TypeScript always needs a separate build step
- 2Yes, and they type-check it like
tsc - ✓Correct answer: Yes, they strip type annotations and run the code, but they don't type-check it
Explanation
Type stripping supports 'erasable' syntax only. Features that need code generation, like enum, need extra flags or a build step. Run tsc --noEmit to check types.