Typescript is an open-source language similar to javascript with more advanced features.

It provides type safety for JavaScript code during the compilation phase.

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

Typescript = Superset of Javascript + Optional Type Safety Checking.

Why Typescript is preferred over Javascript

Typescript provides the 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.
TypeDescription
anyany type accepts any value, equals to javascript variable declaration
unknowndata type is not known at
booleanboolean contains true or false values
numbernumbers contains values of positive, negative, and float values
bigintBigInteger to represents larger integers to avoid rounding errors
stringRepresents Group of characters
symbolused to define keys in objects and maps
ObjectsObjects are basic entities created using typed aliases, interface, and classes
ArraysDatastructures to represent a sequence of objects of the same type
EnumEnumeration of fixed key and values
Type aliasesused to declare typed aliases for custom types
UnionsRepresents union of types
TupleRepresents an array of multiple types
neverType that never returns any value from a function
voidType represents functions that do not return any value
FeatureDescription
Primitive TypesTypescript Inbuilt Primitive Types
CompilerTypescript compiler, convert to Javascript
Handle ErrorsError handling using try, catch, throw.
horizontalPositionHorizontal position - ‘start’, ‘center’, ’end’, ’left’, ‘right’
ClassesObject Oriented Classes
Polymorphismfunctions overloading and overriding
EncapsulationSetter and getter to provide abstraction and protection data
Interface & AbstractDefine interface and abstract classes
ModulesImport and export modules

Latest Typescript Version

The current Latest version is 4.8.3.

Reference:

Official Documentation