List the built-in types in Typescript?

devquora
devquora

Posted On: Feb 22, 2018

 

These are also called the primitive types in Typescript. These are of 5 types: –

  1. Number type: it is used to represent number type values and represents double precision floating point values.

    Syntax- var variable_name: number;

  2. String type: it represents a sequence of characters stored as Unicode UTF-16 code. It is the same as JavaScript primitive type.

    Syntax- var variable_name: string;

  3. Boolean type: in Typescript, it is used to represent a logical value. When we use the Boolean type, we get output only in true or false. It is also the same as JavaScript primitive type.

    Syntax- var variable_name: bool;

  4. Null type: it represents a null literal and it is not possible to directly reference the null type value itself.

    Syntax- var variable_name:number=null;

  5. Undefined type: it is the type of undefined literal. This type of built-in type is the sub-type of all the types.

    Syntax- var variable_name:number=undefined;

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Typescript Interview Questions

    What is Typescript?

    Typescript is a free and open-source programming language which is designed and developed by Microsoft. It was designed ..

    Typescript Interview Questions

    List some features of Typescript?

    Features of Typescript are:- Typescript can be compiled to all major versions of Javascript(ES3,ES5,ES6,ES7). Typescrip..

    Typescript Interview Questions

    List some benefits of using Typescript?

    Following are some benefits of using Typescript One of the biggest advantages of Typescript is its code completion and ..