Skip to content

aperto-frontend/typescript-basics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypeScript Basics

Requirements

Recommended:

  • node.js 8.11.3 LTS + npm installed
  • An IDE with TypeScript support, e.g. Jetbrains WebStorm

Project setup

In order to have a minimal development environment for using TypeScript, execute the following commands on the command line:

  • To create node project and package.json
npm init
  • Install dependencies
npm install typescript --save
# short form
npm i typescript -S
  • Edit package.json and add tsc and start script
{
  "name": "typescript-basics",
  "version": "1.0.0",
  "description": "",
  "private": true,
  "main": "index.js",
  "scripts": {
    "tsc": "tsc",
    "start": "npm run tsc"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "typescript": "^2.9.2"
  }
}
  • Initialize TypeScript project
npm run tsc -- --init
  • Create source folder and index.ts file with "Hello World" output (works on UNIX command line)
mkdir src
touch src/index.ts
echo "console.log('Hello World!');" > src/index.ts
  • Build it
npm run start
  • Run it
node src/index.js

About

Minimal TypeScript development environment setup

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published