Skip to content

TypeScript is a typed superset of JavaScript compiled to JavaScript. In other words, TypeScript is JavaScript plus some additional features.

License

Notifications You must be signed in to change notification settings

shahedbd/TypeScriptBasic

Repository files navigation

Getting Started with TypeScript

Installation

Install TypeScript

$ sudo npm install -g typescript

Check Version

$ node -v
$ tsc -v

Code Format in Editor

  • ⇧⌥F

TypeScript in Visual Studio Code

https://code.visualstudio.com/docs/languages/typescript

First Program:

let myMessage = "Hello world from type script";
console.log(myMessage);

Run Program:

$ tsc HelloWorld.ts
$ node HelloWorld

Watch Program

tsc main.ts --watch

Comments in TypeScript

  • Single-line comments ( // )
  • Multi-line comments (/* */)

Data Types

Data type Keyword Description
Number Number Double precision 64-bit floating point values. It can be used to represent both, integers and fractions.
String String Represents a sequence of Unicode characters
Boolean boolean Represents logical values, true and false
Void Void Used on function return types to represent non-returning functions
Null Null Represents an intentional absence of an object value.
Undefined Undefined Denotes value given to all uninitialized variables

Useful References

About

TypeScript is a typed superset of JavaScript compiled to JavaScript. In other words, TypeScript is JavaScript plus some additional features.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published