Environment to write your first typescript program
Install Node
Go to the official Node.js website: https://nodejs.org/en/download/
Click on the "Windows Installer" button to download the appropriate installer for your system.
Once the installer file has finished downloading, double-click it to run it.
Follow the installer's prompts to complete the installation process. You can generally just accept the default options.
After the installation completes, open the Command Prompt or PowerShell application.
Type node -v into the command prompt to verify that Node.js has been installed correctly. If you see a version number displayed, then it has been installed successfully.
Install TypeScript
Open the Command Prompt or PowerShell application.
Type the following command to install TypeScript using the Node Package Manager (npm):
npm install -g typescript
The -g flag indicates that TypeScript should be installed globally, meaning it will be available throughout your system.
After the installation completes, you can verify that TypeScript is installed by running the following command:
tsc -v
This should display the version number of TypeScript that is installed on your system.
Create a folder "Test" and move to the folder using cd command
open the folder in vscode
type,
code .
in PowerShell prompt
Now create your first ts program
hello.ts
Compile your file
Now run hello.js using node to see output.
Comments
Post a Comment