TIDE
Languages

TypeScript

Installing TypeScript on Ubuntu in TIDE

TypeScript

TypeScript is a strongly typed programming language that builds on JavaScript, giving you better tooling at any scale. It compiles to plain JavaScript.

Installation

TypeScript requires Node.js and NPM. To install TypeScript and ts-node globally on TIDE's Ubuntu environment:

apt update
apt install -y nodejs npm
npm install -g typescript ts-node

Verification

Verify the TypeScript compiler (tsc) installation:

tsc --version

Hello World Example

Create a TypeScript file named hello.ts:

echo 'const message: string = "Hello, TypeScript!"; console.log(message);' > hello.ts

Running with ts-node

You can execute TypeScript files directly using ts-node:

ts-node hello.ts

Compiling and Running with Node.js

Alternatively, compile the TypeScript file into JavaScript and run it with Node.js:

tsc hello.ts
node hello.js

Official Resources

On this page