Typescript is a opensource language similar to javascript with more features.

It provides type safety for javascript code during compilation phase.

Typescript files created with ts extension, that compiled to javascript(.js extension)

Typescript = Superset of Javascript + Optional Type Safety Checking.

Why Typescript is preferred over Javascript

Typescript provides following features

  • Type Inference
  • Type Annotations
  • Type Alias

Typescript features

  • Typescript Primitive Types Any data in typescript is typed at compiled time. The following are types.
Type Description
any any type accepts any value, equals to javascript variable declaration
unknown data type is not known at
boolean boolean contains true or false values
number numbers contains values of positive,negative,float values
bigint BigInteger to represents larger integers to avoid rounding errors
string Represents Group of characters
symbol used to define keys in objects and maps
Objects Objects are basic entities created using typed alias, interface and classes
Arrays Datastructures to represents sequence of objects of same type
Enum Enumeration of fixed key and values
Type aliases used to declare typed aliases for custom types
Unions Represents union of types
Tuple Represents an array of multiple types
never Type that never returns any value from a function
void Type represents functions does not returns any value
Feature Description
Primitive Types Typescript Inbuilt Primitive Types
Compiler Typescript compiler, convert to Javascript
Handle Errors Error handling using try,catch, throw.
horizontalPosition  Horizontal position - ‘start’, ‘center’,‘end’,‘left’, ‘right’
Classes Object Oriented Classes
Polymorhpism functions overloading and overriding
Encapsulation Setter and getter to provide abstraction and protection data
Interface & Abstract Define interface and abstract classes
Modules Import and export modules

Latest Typescript Version

Current Latest version is 4.8.3.


Official Documentation