How do you run TypeScript files from command line

0 votes
It's surprising to have such a hard time with this. I'm used to running my code from the command line and it would be really convenient if I could do the same over here.

Does anyone have an idea on how to do this?
May 31, 2022 in TypeSript by Logan
• 2,140 points
500 views

1 answer to this question.

0 votes

You can leave tsc running in watch mode using tsc -w -p . and it will generate .js files for you in a live fashion, so you can run node foo.js like normal

TS Node

There is ts-node : https://github.com/TypeStrong/ts-node that will compile the code on the fly and run it through node 🌹

npx ts-node src/foo.ts
answered May 31, 2022 by Nina
• 3,060 points

Related Questions In TypeSript

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to install and run Typescript locally in npm?

It took me a while to figure ...READ MORE

answered Jun 8, 2022 in TypeSript by Nina
• 3,060 points
3,546 views
0 votes
1 answer

How to get TypeScript definition files via bower?

The best option is to use tsd. It ...READ MORE

answered Jun 10, 2022 in TypeSript by Nina
• 3,060 points
289 views
0 votes
1 answer

Change the output colour of echo

Try using ANSI escape codes as the following; Black ...READ MORE

answered Jul 13, 2019 in Linux Administration by Shubham
• 13,490 points
550 views
0 votes
1 answer
0 votes
1 answer

TypeScript: How do you loop through a dictionary?

To loop over the key/values, use a for ...READ MORE

answered May 31, 2022 in TypeSript by Nina
• 3,060 points
3,628 views
0 votes
1 answer

How do you typecast in TypeScript?

Casting: return this.createMarkerStyle(<MarkerSymbolInfo> symbolInfo); Or Casting compatible with tsx mode: return ...READ MORE

answered Jun 1, 2022 in TypeSript by Nina
• 3,060 points
368 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP