In this blog,  we will show how to use the Identifiers, keywords & Datatypes that are used in TypeScript program.

Identifiers
  • Identifiers are just names that we give instances like variables, functions, and other things that are declared in a programme.
  • Every programming language has precise guidelines that must be followed when declaring identifiers, and TypeScript is no different.
  • All of JavaScript’s naming conventions are followed by TypeScript, though.
Rules for naming identifier
  • Identifiers can be made up of numerals, underscores, lowercase, and uppercase letters and numbers.
  • There shouldn’t be any spaces between identifiers.
  • A keyword should not be used as an identification.
  • Other special symbols shouldn’t be used besides underscore.
  • An identifier cannot begin with a digit.
  • Examples of correct identifier names are var, _var, _var9, _9var, etc.
  • Examples of incorrect identifier names are 9var, @var, var@, var1@, etc. 
Keywords in typescript

In a programming language, keywords are reserved words that have a specific meaning and perform a specific function in a programme.

The following are some examples of keywords in Typescript:

break, as, any, switchcase , if, throw, else, var, number, string ,get, module, type, instanceof, typeof, public, private, enum, export, finally, for, while, void, null, super, this, new, in, return, true, false, any, extends, static, let, package, implements, interface , function, new, try ,yield, const, continue, do, catch.

 Indentation and whitespace are ignored by TypeScript. However, you can include them to make your code more readable.

Data Types

In TypeScript, data types are useful for defining the type of data that a variable can hold in our application, such as a number, string, boolean, and so on. TypeScript will support all of the types that JavaScript  datatypes.

There are various data types available in typescript:

As you can see from the above diagram, any type, which is a superset of all data types, is pointing to both primitive and user-defined types.

TypeScript Primitive Data Types :

The following table covers the many built-in or primitive data types available in typescript.

Number ,String ,Boolean ,Void , Null , Undefined , Never ,Any.

TypeScript User-defined Data Types :

The following table lists the various typescript user-defined data types.
 
Array , Class , Interface ,Tuple , Enum , Function .