Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
258 views
in Technique[技术] by (71.8m points)

How to run TypeScript programs in Android?

How can I run TypeScript programs using a Android phone? Are there any apps available to run TypeScript programs offline on Android?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can run TypeScript programs on Android using Termux. Follow these steps to run TypeScript in Termux.

  1. Install Termux app from Play Store.

  2. Install Node.js package in termux using the command pkg install nodejs

  3. Install TypeScript node module on Termux using command npm install typescript

  4. Install code editor like Micro using command pkg install micro. You can also use any code editor apps like Acode or Spck.

  5. Create a TypeScript file using command micro hello.ts This will open a editor where you can write your TypeScript code. If you are writing the program using external code editor apps, change the working directory of Termux to the folder where you have saved your TypeScript program.

  6. After writing TypeScript code, come back to terminal and type tsc hello.ts this will compile your TypeScript to JavaScript and create hello.js file in the same directory.

  7. Now you can run the JavaScript file using command node hello.js and it will show output of the code.

For shortcut, you can combine step 6 & 7 commands and use it like tsc hello.ts && node hello.js


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...