Ahoy there! Let’s set up the environment for playing with TypeScript and learn how to run those TypeScript files!
First let’s install TypeScript globally if you don’t have it yet.
npm i -g typescript
(By the way, “npm i X” is the short-hand for “npm install X”)
Now, let’s create your project folder and open it in your beloved editor (mine VS Code)
Let’s init the tsconfig file, type the following command
(This “tsc” command will only work if you have typescript globally installed)
Now you created a TypeScript file, wrote your code, for example an app.ts file with this content
console.log('Hello there TypeScript! You are AMAIZING!!')
Let’s install the packages
npm i ts-node ts-node-dev
“ts-node” is the TypeScript version for “node” and “ts-node-dev” is the TypeScript version for “nodemon”. So to run the TypeScript file use either of these commands
(Which is basically “node app.js”)
(Which is basically “nodemon app.js”)
YIPPIE!! You just set up the environment for coding in TypeScript and also learnt how to run those FILES!! YOOOHOOOO!!! But now what?
(including apk generating)
Drop a comment or Feel free to reach out to me @SilveLEAF on Twitter or Linkedin
Wanna know more about me? Come here!