Can I directly process typescript code into javascript code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can I directly process typescript code into javascript code?

For Example, My typescript code (server.ts) let a:number,b:number; a = 40; b = 2; console.log (a+b); I want to directly run this code as node code.

26th Oct 2019, 5:31 PM
Sarthak
Sarthak - avatar
5 Answers
+ 2
No, you must compile your .ts file to .js . A way to compile is by running `tsc server.ts` in the terminal where your file is located.
8th Nov 2019, 5:28 PM
Veliside
Veliside - avatar
+ 2
Run from Sololearn code playground (on pc only) https://code.sololearn.com/WGIWhwyGD7SX/?ref=app
14th Dec 2019, 2:53 AM
Calviղ
Calviղ - avatar
+ 2
Cannot run from mobile device
14th Dec 2019, 5:01 AM
Calviղ
Calviղ - avatar
+ 1
Actually, it's generating error
14th Dec 2019, 3:42 AM
Sarthak
Sarthak - avatar