Pyjs
Pyjs

Reputation: 109

Why is ts-node not compiling typescript file?

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.

Upvotes: 8

Views: 9241

Answers (1)

Andrew Homeyer
Andrew Homeyer

Reputation: 8108

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.

Upvotes: 8

Related Questions