Wednesday, September 13, 2023

TypeScript

1] Types :-  The core primitive types in TypeScript are all lowercase.

typeof to identify types

a] number    1,  2.5, 10000,  -18

b] string       'abc',  "abc",  `abc`   

c] boolean

d] objects      const person {

    name: string;

    age: number;

    }   = {

        name = 'ABC',

        age = 30

    }

5] array       let colours : string[] = ['blue', 'white']

6] tuple       let colBand : [string, number] 

7] enum      enum Role {ADMIN, READ_ONLY, AUTHOR};

8] any     

9] custom type   , alias

9] callback function 

9] Function

10] never

11] unknown