#7 Type Alias (Advanced Types)

 When we need a same values of type for different constants, instead of repeating the code, we can simply do as example;

type Employee={name: string, id: number}
let user: Employee={name:"Ram",id:10}

Here, we use *type* to create  an object type that can be used for other constants without repeating the code.

Comments

Popular posts from this blog

#6 Objects (Fundamentals of TS)

#8 Union Type (Advanced Types)