Basics
Challenges
Classes
Debugging
Events
External Files
Flow Control
Forms
Functions
Html Elements
Installation
Interfaces
Keywords
Modules
Namespaces
Operators
Reference Files
String
Types
Visual Studio and Visual Studio Code automatically support TypeScript and come with it (the compiler) installed. However, if you need to or want to install it manually, read below.
The compiler (included with TypeScript) is known as tsc
.
To see what version is installed, type tsc -v
or tsc --version
at a Powershell command prompt.
Both Visual Studio and Visual Studio code come with TypeScript support built it so you may not have to do anything. But if you do, see below.
npm install -g typescript
.
This is the node package manager. -g
indicates we
want it installed globally.
To see what version of Node.js is installed, type node -v
at a Powershell command prompt.
Visual Studio Code will tell you which version of ts you are using when you are editing a ts file:
With TypeScript, you get the tsc
- the TypeScript compiler.
tsc
is the TypeScript compiler and it runs on Node.js which should be installed on your local machine.
To run the tsc
and to have it build a package/task (such as tsconfig.json), type tsc -p tsconfig.json
in the root of your project from the command prompt.
To run this task in VS Code, just use the shortcut ctrl + shift + B
.