Reputation: 876
How can I run TypeScript programs using a Android phone? Are there any apps available to run TypeScript programs offline on Android?
Upvotes: 1
Views: 11185
Reputation: 31
There is a step 8 to be added to the answer by Bibek Oli as tsc
is not in the default path:
Either add ~/node_modules/typescript/bin/
to $PATH or put a shell function tsc() { ~/node_modules/typescript/bin/tsc "$@" ; }
to .bash_profile
Upvotes: 1
Reputation: 876
You can run TypeScript programs on Android using Termux. Follow these steps to run TypeScript in Termux.
Download and install official Termux from F-Droid Repository.
Install Node.js package in termux using the command pkg install nodejs
Install TypeScript node module on Termux using command npm install typescript
Install code editor like Micro using command pkg install micro
.
You can also use any code editor apps like Acode or Spck.
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.
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.
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
Upvotes: 9
Reputation: 11
You must install Termux from F-droid since the Google Play Store version is outdated and will be removed soon, the creators are still working on termux on GitHub
Upvotes: 0
Reputation: 103
Also when you install termux try use f-droid package manager to install termux instead of using Google play store as follows https://wiki.termux.com/wiki/Installing_from_F-Droid
Upvotes: 1