Skip to main content

Command Palette

Search for a command to run...

Basic data types in typescript

Published
1 min readView as Markdown
Basic data types in typescript

There are three commonly used primitives data types in Typescript: boolean, string, and number

string can hold like "Hello, Kishar".

let name : string ="Hello, kishar"

If you try to assign number, it will throw an error.

The next commonly used data type is boolean.

let flag : boolean = true;

If you assign string to flag , it will throw an error

The next common data type is number

let age : number = 44;

You can not assign any other value in this age variable.

More from this blog

Knowledge

8 posts

I am data science student passionate about frontend technologies like Vuejs and React . I am currently learning these technologies and some backend tech like flask and django.