Why is ts-node not compiling typescript file?

Viewed 4534

Why is ts-node not compiling and executing typescript file? It is used in terminal like "ts-node scriptfile" It just returns a blank line. What is wrong? Thanks for the help.

1 Answers

ts-node is a typescript executor, not a compiler. If you run npx ts-node script.ts it will execute as typescript, without compiling.

To generate a compiled js file, try tsc script.ts.

Related